mol
Posted: Thu Nov 10, 2016 4:27 pm
Sorry, Pablo, I don't understand what do you mean...
Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
http://mail.hmgforum.com/
This problem can be solved by capturing WM_COMMAND message:mol wrote:My friend Edward found problem with On Key ESCAPE...
Code: Select all
#include "hmg.ch"
PROCEDURE Main()
DEFINE WINDOW frmMain ;
AT 0,0 ;
WIDTH 800 HEIGHT 500 ;
TITLE 'Test' ICON 'R';
MAIN;
ON INIT (frmMain.Minimize, msgbox('The "Escape" will not work in the system until you restore "R" application from the tray'));
NOTIFYICON 'R' ;
NOTIFYTOOLTIP 'Test' ;
ON NOTIFYCLICK frmMain.Restore;
ON MINIMIZE frmMain.Hide;
VISIBLE .F.
DEFINE NOTIFY MENU
ITEM 'Restore' ACTION frmMain.Restore
SEPARATOR
ITEM 'Exit' ACTION frmMain.Release
END MENU
DEFINE MAIN MENU
DEFINE POPUP '&Exit' NAME menu_xit
MENUITEM 'Exit' ACTION IF(MsgYesNo('Exit?',,.T.), ThisWindow.Release, Nil)
END POPUP
END MENU
END WINDOW
//ON KEY ESCAPE of frmMain ACTION IF(MsgYesNo('Exit?',,.T.), frmMain.Release, Nil)
EventCreate('frmMain_WM_COMMAND', frmMain.HANDLE, 273 /*WM_COMMAND*/)
CENTER WINDOW frmMain
ACTIVATE WINDOW frmMain
RETURN // Main()
FUNCTION frmMain_WM_COMMAND()
IF (LoWord(EventWPARAM()) == 2 /*IDCANCEL*/) .and. MsgYesNo('Exit?', , .T.)
frmMain.Release
ENDIF
RETURN NIL