Page 1 of 1

How to oDlg:End() in GET MEMO by press escape?

Posted: Sat Mar 22, 2008 11:34 pm
by dutch
Dear All,

I would like to :End() Dialog with Escape Key in GET MEMO. This code doesn't work. How can I do it?

Code: Select all

  DEFINE DIALOG oDlgs FROM  0, 0 TO 24+200, 390 TITLE 'Test' ;
              PIXEL FONT oFnts

              oDlgs:lHelpIcon := .F.
              
       	@  0, 0  GET oGet VAR cPosItem SIZE 195, 102 PIXEL ;
		MEMO OF oDlgs 
       		
     oGet:bGotFocus  := {|| (oGet:SetPos(0))}		
     oGet:bKeyDown := {||nKey| iif(nKey=VK_ESCAPE, oDlgs:End(), ) }
              
       ACTIVATE DIALOG oDlgs ON INIT (oDlgs:Move( 335,  85 )) NOWAIT RESIZE16
Regards,
Dutch

Posted: Sun Mar 23, 2008 7:59 am
by Natter
oGet:nDlgCode:= DLGC_WANTALLKEYS

Re: How to oDlg:End() in GET MEMO by press escape?

Posted: Sun Mar 23, 2008 8:58 am
by Enrico Maria Giordano
dutch wrote:Dear All,

I would like to :End() Dialog with Escape Key in GET MEMO.
You don't need any additional code as that's the default behavior. Ie: you don't need of
dutch wrote:

Code: Select all

oGet:bKeyDown := {||nKey| iif(nKey=VK_ESCAPE, oDlgs:End(), ) }
By the way, there is a little typo in the above code:

Code: Select all

{||nKey|
shold be

Code: Select all

{|nKey|
EMG

Posted: Sun Mar 23, 2008 10:42 am
by dutch
Thanks Enrico,

I saw it. :oops:

Regards,
Dutch