Finrod Narmolanya Posted September 30, 2005 Posted September 30, 2005 I'm new to AutoIT and i have a question about the tray function in the beta. to call a GUI from the tray menu works fine but using a button or any another control to hide the GUI and come back to the traymenu doesn't work ( or better i don't know how to!) Can someone tell me how to make it work? Here is my simple code expandcollapse popup#include <GUIConstants.au3> Global Const $s_Title = 'Tray & GUI' Global Const $s_Version = 'v0.1' Global Const $GUI_Height = '457' Global Const $GUI_Width = '412' Opt("TrayMenuMode",1) TraySetToolTip($s_Title & " - " & $s_Version) $settingsitem = TrayCreateItem("Preferences") TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("End") TraySetState() $PreferencesWindow = GUICreate($s_Title &" " & $s_Version & " Preferences", $GUI_Width, $GUI_Height) $ButtonendePref = GUICtrlCreateButton("OK", 320,405,60) GUISetState(@SW_HIDE) While 1 $msgTray = TrayGetMsg() $msgGui = GUIGetMsg() Select Case $msgTray = 0 ContinueLoop Case $msgGui = $ButtonendePref MsgBox ("", "Ende", $s_Title & " " & $s_Version) Case $msgTray = $aboutitem MsgBox ("", "Über", $s_Title & " " & $s_Version) Case $msgTray = $settingsitem Switch2PreferencesWindow() Case $msgTray = $exititem ExitLoop EndSelect WEnd Exit Func Switch2PreferencesWindow() GUISwitch($PreferencesWindow) GUISetState(@SW_Show) EndFunc
Finrod Narmolanya Posted September 30, 2005 Author Posted September 30, 2005 Ok, I found a solution. Changing this part of code from "case" to "if... then... else..." seems to work fine ) While 1 $msgTray = TrayGetMsg() $msgGUI = GUIGetMsg() If $msgGUI = $ButtonendePref Then GUISwitch($PreferencesWindow) GUISetState(@SW_Hide) EndIf If $msgTray = $aboutitem Then MsgBox ("", "Über", $s_Title & " " & $s_Version) Endif If $msgTray = $exititem then ExitLoop EndIf wend
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