Miliardsto Posted June 24, 2019 Posted June 24, 2019 Hello I have problem with traymenu. If I run function trayMenu() with has inside while loop of course main loop (main program with gui) does not work. This is how it looks in init file trayMenu() #include "../inc/whileLoop.au3" Func trayMenu() Global $trayExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. While 1 Switch TrayGetMsg() Case $trayExit ; Exit the loop. Terminate() EndSwitch Wend EndFunc #MAIN LOOP While 1 $nMsg = GUIGetMsg() Switch $nMsg ; ===================================================== CORE ACTIONS ========================================================================== Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON _Metro_GUIDelete($GUI) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs! Exit Case $GUI_MINIMIZE_BUTTON GUISetState(@SW_MINIMIZE, $GUI) Case $GUI_EVENT_RESTORE restore_switchGUI() ;_switchGUI($gui_active,$gui_active) ; normal switch causing problem Case $GUI_MENU_BUTTON ;Create an Array containing menu button names Local $MenuButtonsArray = $menusArray ; get from global array ; Open the metro Menu. See decleration of $MenuButtonsArray above. Local $MenuSelect = _Metro_MenuStart($GUI, 140, $MenuButtonsArray) EndSwitch WEnd is there possibility to main loop contain second switch for TrayGetMsg() ? Or how achieve it working together
Aelc Posted June 24, 2019 Posted June 24, 2019 (edited) expandcollapse popupFunc trayMenu() Global $trayExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. EndFunc While 1 $tray = TrayGetMsg() $nMsg = GUIGetMsg() Switch $nMsg ; ===================================================== CORE ACTIONS ========================================================================== Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON _Metro_GUIDelete($GUI) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs! Exit Case $GUI_MINIMIZE_BUTTON GUISetState(@SW_MINIMIZE, $GUI) Case $GUI_EVENT_RESTORE restore_switchGUI() ;_switchGUI($gui_active,$gui_active) ; normal switch causing problem Case $GUI_MENU_BUTTON ;Create an Array containing menu button names Local $MenuButtonsArray = $menusArray ; get from global array ; Open the metro Menu. See decleration of $MenuButtonsArray above. Local $MenuSelect = _Metro_MenuStart($GUI, 140, $MenuButtonsArray) EndSwitch Switch $tray Case $trayExit ; Exit the loop. Terminate() EndSwitch WEnd 25 minutes ago, Miliardsto said: is there possibility to main loop contain second switch for TrayGetMsg() ? yes like you said, Edited June 24, 2019 by Aelc why do i get garbage when i buy garbage bags?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now