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

Moderator: Rathinagiri

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

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

Post 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
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

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

Post by srvet_claudio »

I will check.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
mol
Posts: 3727
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

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

Post 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 
************************
User avatar
serge_girard
Posts: 3173
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

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

Post 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
There's nothing you can do that can't be done...
User avatar
mol
Posts: 3727
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

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

Post 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
User avatar
serge_girard
Posts: 3173
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

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

Post by serge_girard »

Marek, So you and I are not alone... !

Serge
There's nothing you can do that can't be done...
User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

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

Post by quartz565 »

serge_girard wrote:Marek, So you and I are not alone... !

Serge
+1
Best Regards,
Nikos.

os: Windows Server 2019 - 64
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 »

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. ;)
Last edited by Pablo César on Thu Nov 10, 2016 5:12 pm, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mol
Posts: 3727
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

mol

Post by mol »

It's not solution, Pablo. Something is wrong with too much agressive code of IDE...
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 »

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:
Last edited by Pablo César on Thu Nov 10, 2016 5:12 pm, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply