dcget keyblock

This forum is for eXpress++ general support.
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dcget keyblock

#11 Post by rdonnay »

Zdeno -

I'm going to need more time to figure out a solution.

Roger
The eXpress train is coming - and it has more cars.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: dcget keyblock

#12 Post by skiman »

Hi Jack,

Nice solution for the keyblock.

I don't know if you are aware that there is an undocumented milliseconds() function in Xbase++? Maybe it could be of help to make your timer class with less code?
Best regards,

Chris.
www.aboservice.be

BruceN
Posts: 280
Joined: Thu Jan 28, 2010 7:46 am
Location: Slidell, LA

Re: dcget keyblock

#13 Post by BruceN »

is that millisec() the same as sleep() except in 1/1000 instead of 1/00?
There are only 10 kinds of people - those who understand binary and those who don't :)

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: dcget keyblock

#14 Post by skiman »

Hi,

No, it is the same as seconds(), except it gives you the milliseconds() since midnight.
Best regards,

Chris.
www.aboservice.be

Zdeno Bielik
Posts: 147
Joined: Thu Jan 28, 2010 9:24 am
Location: Nitra, Slovakia
Contact:

Re: dcget keyblock

#15 Post by Zdeno Bielik »

jdsoft wrote:In your keyblock, insert the code: ....
Hi Jack,

please, can you compile and run attached example and tell me, where is problem?
It looks it still works how I don't want, all code after stoped time is executed N times...
so different is only that it is not running immediatelly after each character is typing, but at once N times after delay.

Zdeno
Attachments
test.zip
(1.82 KiB) Downloaded 698 times

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dcget keyblock

#16 Post by rdonnay »

Here is a sample that appears to be doing what you want:

Code: Select all

#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"

FUNCTION Main()

LOCAL GetList[0], cGet := Space(50), aDir := Directory(), oBrowse, bAction

bAction := {|oGet|MyKeyboard(oBrowse,oGet)}

@ 0,0 DCGET cGet KEYBLOCK {|n,x,oGet|MyKeyDelay(n,0.8,oGet)}

@ 2,0 DCBROWSE oBrowse DATA aDir SIZE 60,25

DCBROWSECOL ELEMENT 1 HEADER 'File Name' WIDTH 50 PARENT oBrowse

DCUSEREVENT xbeP_User + 10 ACTION bAction

DCREAD GUI FIT

RETURN nil

* ----------

FUNCTION MyKeyDelay( nKey, nDelay, oGet, bBlock )

LOCAL nEvent, oXbp, mp1, mp2, nSeconds := Seconds()

DEFAULT nDelay := 0

IF nDelay > 0
  DO WHILE Seconds() - nSeconds < nDelay .AND. ( nKey < 60000 )
    nEvent := AppEvent(@mp1,@mp2,@oXbp,.1)
    IF Valtype(oXbp) == 'O'
       oXbp:handleEvent(nEvent,mp1,mp2)
    ENDIF
  ENDDO
ENDIF

PostAppEvent( xbeP_User + 10, oGet )

RETURN nil

* -------------

STATIC FUNCTION MyKeyboard( oBrowse, oGet )

LOCAL cBuffer := Trim(oGet:get:buffer), nArrayElement

nArrayElement := AScan(oBrowse:dataSource,{|a|Upper(a[1])=Upper(cBuffer)})

IF nArrayElement > 0
  oBrowse:arrayElement := nArrayElement
ENDIF

oBrowse:refreshAll()
DC_ClearEvents()

RETURN nil

* -------------

PROC appsys ; return
The eXpress train is coming - and it has more cars.

Zdeno Bielik
Posts: 147
Joined: Thu Jan 28, 2010 9:24 am
Location: Nitra, Slovakia
Contact:

Re: dcget keyblock

#17 Post by Zdeno Bielik »

Roger,

thank you!!! thank you!!! thank you!!! :clap: :clap: :clap:

It looks it is OK now, super!!! :dance:

Zdeno

Post Reply