Page 1 of 2

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

Posted: Thu Nov 03, 2016 1:45 pm
by mol
My friend Edward found problem with On Key ESCAPE...

He built app running i n system tray which is ESC sensitive.
But, ESC key is blocked for all running application, until his app is placed in tray.
Try to compile his small sample

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)
        
        CENTER WINDOW frmMain
        ACTIVATE WINDOW frmMain

    QUIT	
RETURN // Main()

You should run another application which waits for ESC to observe bad working.

Regards, Marek

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

Posted: Thu Nov 03, 2016 1:58 pm
by srvet_claudio
I will check.

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

Posted: Fri Nov 04, 2016 8:17 am
by mol
Edward solved the problem by setting FrmMain.Visible to .t. and creating function for restore FrmMain in which action of ESC key is defined:

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 restoreMain();
           ON MINIMIZE frmMain.Hide;
           VISIBLE .T. 
                               
           DEFINE NOTIFY MENU
                                               ITEM 'Restore'  ACTION restoreMain()
                                               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
        
        CENTER WINDOW frmMain
        ACTIVATE WINDOW frmMain

    QUIT 
RETURN // Main()
************************
PROCEDURE restoreMain()
DECLARE WINDOW frmMain

ON KEY ESCAPE OF frmMain ACTION IF(MsgYesNo('Exit?',,.T.),frmMain.Release,Nil)
frmMain.Restore

RETURN 
************************

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

Posted: Fri Nov 04, 2016 8:22 am
by serge_girard
Hi Marek,

Sometimes I experience some similar effect with the F5 key: pressing it invokes HMG-IDE ti start compiling while I pressed in my browser or so.

Serge

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

Posted: Fri Nov 04, 2016 11:27 am
by mol
serge_girard wrote:Hi Marek,

Sometimes I experience some similar effect with the F5 key: pressing it invokes HMG-IDE ti start compiling while I pressed in my browser or so.

Serge
I reach this effect often while working with Total Commander - F5 is not copying files but is overtaken by IDE and compiles open project

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

Posted: Fri Nov 04, 2016 12:59 pm
by serge_girard
Marek, So you and I are not alone... !

Serge

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

Posted: Fri Nov 04, 2016 6:23 pm
by quartz565
serge_girard wrote:Marek, So you and I are not alone... !

Serge
+1

I am in favor of improvements required for IDE

Posted: Fri Nov 04, 2016 8:37 pm
by Pablo César
serge_girard wrote:Marek, So you and I are not alone... !

Serge
+ 1 (me too)

I try always to avoid this unwanted action of IDE by making focus only in the source editor but sometimes It happen with me too... :oops:

We could let our suggestion to make IDE configurable and to disable hotkeys at IDE, only by clicking at RUN button and then compile the project. ;)

mol

Posted: Fri Nov 04, 2016 11:09 pm
by mol
It's not solution, Pablo. Something is wrong with too much agressive code of IDE...

I am in favor of improvements required for IDE

Posted: Thu Nov 10, 2016 1:18 pm
by Pablo César
mol wrote:It's not solution, Pablo. Something is wrong with too much agressive code of IDE...
Agressive? I don't think so. I'm talking a normal flag that could helps to IDE to define how to behaviour wished by the user.

Wrongly attempt when have pressed F5 and HMG/IDE builds again the project...

Like another case when we create a new project in IDE and "always" receives the same name Main as name of fmg and prg main file...

I like speed on my programming tools but I also wish practicity. I am opposite to this slogan:

Why make it easier if we can complicate? :lol: