Jump to content

Recommended Posts

Posted

 

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

 

 

Posted (edited)
Func 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 by Aelc

why do i get garbage when i buy garbage bags? <_<

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...