kalans Posted April 2, 2012 Share Posted April 2, 2012 (edited) Sorry the title does not explain it much, as I will try to do my best below. What I Need To Happen: -Press a button, GUI buttons come up (works fine) -These buttons will keep displayed until you click outside the GUI area it created (works, not efficiently) -Clicking the button will display the buttons via GUI again (not working) The script is below: Func QuickMenu() $aWin = WinGetPos($GUI) $QuickMenu = GUICreate("", 300, 25, -1, $aWin[1] + 50, $WS_POPUP, $WS_EX_LAYERED) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($QuickMenu, 0xABCDEF, 255) $Recipes = GUICtrlCreateButton("Recipes", 0, 0, 75, 25) $Calcs = GUICtrlCreateButton("Calcs", 75, 0, 75, 25) $Notes = GUICtrlCreateButton("Patch Notes", 150, 0, 75, 25) $EditMH = GUICtrlCreateButton("Edit MH", 225, 0, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Recipes Recipes() Case $Calcs Calcs() Case $Notes PatchNotes() Case $EditMH EditMH() EndSwitch If Not WinActive($QuickMenu) Then ExitLoop WEnd GUIDelete($QuickMenu) EndFunc ;==>QuickMenu So it works fine, and I click outside the given GUI area but when I click the button again to create the GUI (again) it will not display at all. It does not even generate, as it is not in the task tray on the second round. More code available on request, and thank you very much for looking Wasn't sure if I should post this here or gen help. PS: $GUI is the default GUI, other GUI names are different and $GUI does not get overwritten. Edited April 2, 2012 by kalans Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 2, 2012 Moderators Share Posted April 2, 2012 kalans, The function works fine for me - the menu GUI appears and disappears as you say you want: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $hGUI = GUICreate("Test", 500, 500) $cButton = GUICtrlCreateButton("QM", 10, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton QuickMenu() EndSwitch WEnd Func QuickMenu() $aWin = WinGetPos($hGUI) $QuickMenu = GUICreate("", 300, 25, -1, $aWin[1] + 50, $WS_POPUP, $WS_EX_LAYERED) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($QuickMenu, 0xABCDEF, 255) $Recipes = GUICtrlCreateButton("Recipes", 0, 0, 75, 25) $Calcs = GUICtrlCreateButton("Calcs", 75, 0, 75, 25) $Notes = GUICtrlCreateButton("Patch Notes", 150, 0, 75, 25) $EditMH = GUICtrlCreateButton("Edit MH", 225, 0, 75, 25) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $Recipes ;Recipes() Case $Calcs ;Calcs() Case $Notes ;PatchNotes() Case $EditMH ;EditMH() EndSwitch If Not WinActive($QuickMenu) Then ExitLoop WEnd GUIDelete($QuickMenu) EndFunc ;==>QuickMenu What is different in your script? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kalans Posted April 2, 2012 Author Share Posted April 2, 2012 Bah, I have $quickmenu and $QuickMenu..The lower case option was a button and the upper was a GUI, change var names and it is good to go! Thank you so much for the help, I was dumbfounded when it was not working >.< Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 2, 2012 Moderators Share Posted April 2, 2012 kalans, Always a good idea to use type identifiers with your variables. These are the ones I use to give you an idea: $a - Array $b - Binary data. $h - Handle, usually to a file or window. NB: AutoIt handled controls return IDs, and so use $c instead. $c - An AutoIt control Id. $i - Integer. $f - Boolean. $n - Floating point number. $s - String. $v - Variant (unknown/variable type of data). $p - Pointer. $t - Structure returned from DllStructCreate. $tag - Struct definition string. No reason to use exactly the same ones, but something along these lines really does help prevent the sort of naming clash you just had. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kalans Posted April 2, 2012 Author Share Posted April 2, 2012 So basic, and very helpful hehe. Thanks! Link to comment Share on other sites More sharing options...
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