monitoring key stroke inside tget object.

Post Reply
xhbcoder
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

monitoring key stroke inside tget object.

Post by xhbcoder »

hi all,

Is there a way to monitor a keytroke in a tget object? Similar to bkeydown in dialogs.

Thanks!
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

You can do it exactly in the same way:

oGet:bKeyDown := { | nKey, nFlags | ... }
regards, saludos

Antonio Linares
www.fivetechsoft.com
xhbcoder
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

Post by xhbcoder »

Hi antonio,

I tried the following, but my function is not called.


oCtrl := CGet():New(edRow*REDUCE*13

Ctrl:oGet:bKeyDown :={|nkey,nflags,oCtrl|ls_keyd2(nkey,nflags,octrl)} // jdd

Thanks.
xhbcoder
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

Post by xhbcoder »

Hi antonio,

oCtrl := tGet():New(.....)
oCtrl:oGet:Name="some name"
msginfo(oCtrl:oGet:Name) <---- it is okay to this code

oCtrl:oGet:bKeyDown :={|nkey,nflags|ls_keyd2(nkey,nflags)} <-- getting an no method get: _bkeydown

Thank you very much.

Jose

Here's actual code:
oCtrl := tGet():New(edRow*REDUCE*13,;
((if(edCol==1,1,40)+nMaxLen-1)*4)-nWidth,;
bField,oDlg,nWidth,10,edPic,;
if(edVal==NIL,NIL, &( "{|self|" +edVal +"}" ) ),;
,,oFont,.f.,,.t.,edFld,.t.,if(edPmt=" ",{||.f.},{||.t.}),;
.f.,valtype(eval(bField))="N",,.f.,lEncrypted)

oCtrl:oGet:Name := edFld
****************** // jdd
*oCtrl:oGet:reader :={|oGet|ls_trapKey(oGet)}

*aadd(memvar->xoctrl,oCtrl)
*msginfo(valtype(memvar->xoctrl))
msginfo(oCtrl:oGet:Name)

oCtrl:oGet:bKeyDown :={|nkey,nflags|ls_keyd2(nkey,nflags)} // jdd
msginfo(valtype(oCtrl:oGet:bKeyDown))
********************* // jdd
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Jose,

Use oCtrl:bKeyDown (not oCtrl:oGet:bKeyDown)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply