=sinister= Posted October 8, 2007 Share Posted October 8, 2007 alright i have a context menu: $ContextMenu = GUICtrlCreateContextMenu() $SetOnTop = GUICtrlCreateMenuItem("Set OnTop", $ContextMenu) $Transparent = GUICtrlCreateMenuItem("Transparent", $ContextMenu) but, I try using this with the context menu: Case $SetOnTop If BitAnd(GUICtrlRead($SetOnTop),$GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($SetOnTop,$GUI_UNCHECKED) WinSetOnTop("WoW!Bobber", "", 0) Else GUICtrlSetState($SetOnTop,$GUI_CHECKED) WinSetOnTop("WoW!Bobber", "", 1) EndIf and it won't work on its first try. Any ideas? Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 9, 2007 Share Posted October 9, 2007 alright i have a context menu: $ContextMenu = GUICtrlCreateContextMenu() $SetOnTop = GUICtrlCreateMenuItem("Set OnTop", $ContextMenu) $Transparent = GUICtrlCreateMenuItem("Transparent", $ContextMenu) but, I try using this with the context menu: Case $SetOnTop If BitAnd(GUICtrlRead($SetOnTop),$GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($SetOnTop,$GUI_UNCHECKED) WinSetOnTop("WoW!Bobber", "", 0) Else GUICtrlSetState($SetOnTop,$GUI_CHECKED) WinSetOnTop("WoW!Bobber", "", 1) EndIf and it won't work on its first try. Any ideas? You can only work with Checked/UnChecked if you use the MenuRadioItem option in GuiCtrlCreateMenuItem. I created a demo with two items (and a separator between them) in the GUI's context menu, but with the MenuRadioItem option, I could only set it the first time it was selected, could never clear it by selecting again, and could not get any of several methods to give me current checked state of the item. So I gave up on it and went with external global variables to hold the state of the items: #include <guiconstants.au3> #include <A3LMenu.au3> Global $SetOnTopState = False, $TransparentState = False $hGUI = GUICreate("Test", 300, 100) $Label_1 = GUICtrlCreateLabel("SetOnTop = " & $SetOnTopState, 10, 20, 200, 20, $SS_CENTER) $Label_2 = GUICtrlCreateLabel("Transparent = " & $TransparentState, 10, 60, 200, 20, $SS_CENTER) $ContextMenu = GUICtrlCreateContextMenu() $hContextMenu = GUICtrlGetHandle(-1) $SetOnTop = GUICtrlCreateMenuItem("Set OnTop", $ContextMenu) $Transparent = GUICtrlCreateMenuItem("Transparent", $ContextMenu) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $SetOnTop $SetOnTopState = Not $SetOnTopState GUICtrlSetData($Label_1, "SetOnTop = " & $SetOnTopState) Case $Transparent $TransparentState = Not $TransparentState GUICtrlSetData($Label_2, "Transparent = " & $TransparentState) EndSwitch WEnd That doesn't mean it can't be done, but I couldn't make it work in the time I have to try... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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