trying to hide a menu by pressing the key that shows it

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Herchi
Posts: 27
Joined: 07 Mar 2018, 08:19

trying to hide a menu by pressing the key that shows it

27 Feb 2020, 08:08

hi, I have a menu painted with the 'F9' that a menu item is Cancel and when I click there it closes the menu.
I wanted him to hide it as a switch when he returned to 'F9'.
The logic I paint here has gone perfectly for a ToolTip that with a key I painted and erased.

Code: Select all

GLOBAL menuMostrado := false
Cancelar:
Return

F9::
    if (%menuMostrado%) {
        ;pintarMensaje("a")
	menuMostrado = false
        SendInput {Esc} ;simular 'Esc' para cerrar el menú
    } else {
	;pintarMensaje("b")
        menuMostrado = true
        pintarMenu()
    }
Return

pintarMenu() {
    Menu, menuProgramas, Add
    Menu, menuProgramas, deleteAll
    
    ;Sies
    Menu, submenu_sies, Add, &IC, sies_IC
    Menu, submenu_sies, Icon, &IC, iconos\sies.ico ,, %TAMANO_ICONO_MENU_NIVEL_2%
   ; long etc
}
I wanted to call the Cancel function, I tried 'Cancel()' and 'Cancel' but I got an error.
The second idea that occurred to me was to call SendInput {Esc} as a touch to Escape would also work, but it does nothing.

So I could not. :(

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Chunjee, Nerafius, scriptor2016 and 94 guests