kiboost Posted July 25, 2011 Posted July 25, 2011 Hi, I have a gui with a menu, and I try to detect detect the state of a menu item, but can't find how. example : $RFR_menu = GUICtrlCreateMenu("RFR") $RFR_menuitem[1] = GUICtrlCreateMenuItem("Allways on Top", $RFR_menu) GUICtrlSetOnEvent(-1,"allwaystop") Func allwaystop() $state = GUICtrlGetState ($RFR_menuitem[1]) ConsoleWrite(@CR&"$state "&$state&@CR) If $state = 0 Then WinSetOnTop("RenderFarmer", "", 1) GUICtrlSetState($RFR_menuitem[1], 1) Else WinSetOnTop("RenderFarmer", "", 0) GUICtrlSetState($RFR_menuitem[1], 0) EndIf EndFunc Any idea ? Thks Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79
kiboost Posted July 25, 2011 Author Posted July 25, 2011 ok like often, I've spent two hours on this one last friday and I ask here to find the answer a few minutes after posting .. so $state = GUICtrlRead ($RFR_menuitem[1]) state 68 = unchecked, 65 = checked Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79
PsaltyDS Posted July 27, 2011 Posted July 27, 2011 Remember that state contains bits for other conditions besides CHECKED/UNCHECKED, so you need to test for the right bit instead of the whole value: #include <GUIConstantsEx.au3> ; ... If BitAND($GUI_CHECKED, GUICtrlRead($RFR_menuitem[1])) Then ; Checked! Else ; Not checked. EndIf 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
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