Necesito salir con la tecla VK_ESCAPE en un BUTTONBAR pero no lo hace.
Aqui el codigo que uso.
- Code: Select all Expand view
static Function DialogMain()
Local oDlg
Local oFont
Local oBar
Local bKeydown
Local oBtn := Array(4)
Local lExitDlg := FALSE
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12 BOLD
DEFINE DIALOG oDlg RESOURCE "ButtonBar" TITLE "Egreso de Caja" FONT oFont ICON aBitmap[ BMP32_ICON ];
TRANSPARENT
REDEFINE BUTTONBAR oBar id 100 OF oDlg 2010 SIZE 75, 70
DEFINE BUTTON oBtn[1] OF oBar;
PROMPT "Nueva";
RESOURCE aBitmap[ BMP32_NEW ];
DEFINE BUTTON oBtn[2] OF oBar;
PROMPT "Buscar";
RESOURCE aBitmap[ BMP32_SEARCH ];
DEFINE BUTTON oBtn[3] OF oBar;
PROMPT "Listar";
RESOURCE aBitmap[ BMP32_BROWSE ];
GROUP
DEFINE BUTTON oBtn[4] OF oBar;
PROMPT "Salir";
RESOURCE aBitmap[ BMP32_EXIT ];
ACTION ( lExitDlg:= TRUE, oDlg:End() );
GROUP
oBtn[4]:lCancel = TRUE
oBar:WinStyle( WS_BORDER, .F. )
AEval( oDlg:aControls, {|o| o:bKeyDown := {|nKey| KeyDown( nKey, oDlg, @lExitDlg )} } )
ACTIVATE DIALOG oDlg;
VALID lExitDlg;
ON INIT ( DisableSysMenuDlg(oDlg) )
RELEASE FONT oFont
Return Nil
static Function KeyDown( nKey, oDlg, lExitDlg )
if GetKeyState( VK_ESCAPE )
? "VK_escape"
lExitDlg := TRUE
oDlg:End()
else
? "nKey", nKey
endif
Return Nil