ON KEY ESCAPE blocks ESC key for all applications running on system...

Moderator: Rathinagiri

User avatar
mol
Posts: 3728
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

mol

Post by mol »

Sorry, Pablo, I don't understand what do you mean...
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

I am in favor of improvements required for IDE

Post by Pablo César »

Marek, when we have an ideal tool for working, all work yields and gains a lot of time. To implement user configuration to be serviced by IDE working as the user would like to work, do not necessary need to implememnt agressive methods.

What we have is to make ou wrokbench the most flexible and pratical for us. We can not have fear to make implementations. The important is to study how to do it...

We have to make our tools easier, tools must be with flexibility to adapt it to us the users. Not the opposite, ie. users needs to adapt for using the application, in case.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: ON KEY ESCAPE blocks ESC key for all applications running on system...

Post by KDJ »

mol wrote:My friend Edward found problem with On Key ESCAPE...
This problem can be solved by capturing WM_COMMAND message:
EventCreate('frmMain_WM_COMMAND', frmMain.HANDLE, 273 /*WM_COMMAND*/)
and checking wParam:
IF (LoWord(EventWPARAM()) == 2 /*IDCANCEL*/)

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
Post Reply