![Laughing :lol:](./images/smilies/icon_lol.gif)
![Laughing :lol:](./images/smilies/icon_lol.gif)
Moderator: Rathinagiri
I've just come out from bed and don't took my morning coffee yet...but... What do you exactly mean with 'activate a menu via a hotkey'?mol wrote:When you activate main or context menu (by hotkey(I like hotkey lastdays
)), there is no way to dewactivate it eg. by pressing ESCAPE. It's annoying in my opinion, because when I'm working with keyboard, I need to use mouse to click in any other place on the screen.
Ok. I'll check it, but, anyway, IMHO this is not a bug... maybe a missing feature, but not a bug...mol wrote:Simply, I define main menu with positions:
FILE
TOOLS
HELP....
When I presss Alt-F - main menu is activated.
But, there is no way to deactivate it by keyboard, when no action from menu is needed.
Anyway... could be you so kind to post a sample?mol wrote:I didn't know, where to place it....
Code: Select all
#include <hmg.ch>
Function Main
DEFINE WINDOW Main ;
AT 0,0 ;
WIDTH 550 ;
HEIGHT 350 ;
TITLE 'Menu Test' ;
MAIN
DEFINE MAIN MENU
DEFINE POPUP "File"
MENUITEM "exit" ACTION Main.Release
END POPUP
DEFINE POPUP "Help"
MENUITEM "About..." ACTION MsgInfo("Test of Main Menu")
MENUITEM "About HMG" ACTION MsgBox(HmgVersion())
END POPUP
END MENU
@ 80,160 BUTTON Button_1 ;
CAPTION "Press to activate second window" ;
ACTION SecondWindow() ;
WIDTH 200 ;
HEIGHT 60
END WINDOW
On KEY ESCAPE OF Main Action {|| msgBox("Ending program"), Main.Release}
Main.Center
Main.Activate
Return
*-----------------------------------------
function SecondWindow
DEFINE WINDOW Second ;
AT 200,200 ;
WIDTH 550 ;
HEIGHT 350 ;
TITLE 'Menu Test' ;
MODAL
DEFINE MAIN MENU
DEFINE POPUP "File"
MENUITEM "Close this window" ACTION Second.Release
END POPUP
DEFINE POPUP "Help"
MENUITEM "About..." ACTION MsgInfo("Test of Main Menu")
MENUITEM "About HMG" ACTION MsgBox(HmgVersion())
END POPUP
END MENU
@ 20,40 LABEL Label_1 WIDTH 260 HEIGHT 20 ;
VALUE "This is second window" ;
FONT "Arial" SIZE 14
@ 60,40 LABEL Label_2 WIDTH 380 HEIGHT 20 ;
VALUE "Try to activate main menu pressing Alt-F" ;
FONT "Arial" SIZE 14
@ 100,40 LABEL Label_3 WIDTH 320 HEIGHT 30 ;
VALUE "Then press ESC key to close it" ;
FONT "Arial" SIZE 14
END WINDOW
// when you change code to like this:
// Message is displayed, but releasing window Second is omitted.
//On Key ESCAPE OF Second Action {|| msgbox("I'm closing second window") , Second.Release}
On Key ESCAPE OF Second Action Second.Release
activate window Second
return
Thanks!mol wrote:I've prepared sample.
Well...Roberto Lopez wrote:Thanks!mol wrote:I've prepared sample.
HiRoberto Lopez wrote: ... if someone has additional information that helps on this, please post here!