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

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post 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
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Post by Natter »

oGet:nDlgCode:= DLGC_WANTALLKEYS
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

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

Post 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
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Thanks Enrico,

I saw it. :oops:

Regards,
Dutch
Post Reply