Page 1 of 1

monitoring key stroke inside tget object.

Posted: Tue Jan 30, 2007 12:13 am
by xhbcoder
hi all,

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

Thanks!

Posted: Tue Jan 30, 2007 8:21 am
by Antonio Linares
You can do it exactly in the same way:

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

Posted: Tue Jan 30, 2007 4:05 pm
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.

Posted: Tue Jan 30, 2007 4:58 pm
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

Posted: Tue Jan 30, 2007 5:06 pm
by Antonio Linares
Jose,

Use oCtrl:bKeyDown (not oCtrl:oGet:bKeyDown)