youtuber Posted November 27, 2017 Posted November 27, 2017 Button is shaking when checking Radio #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 539, 438, 192, 124) $Radio1 = GUICtrlCreateRadio("Radio1", 112, 80, 113, 17) $Radio2 = GUICtrlCreateRadio("Radio2", 112, 120, 113, 17) $Radio3 = GUICtrlCreateRadio("Radio3", 112, 160, 113, 17) $Radio4 = GUICtrlCreateRadio("Radio4", 112, 200, 113, 17) $Button1 = GUICtrlCreateButton("Button1", 112, 272, 75, 25) GUICtrlSetState($Button1, $GUI_DISABLE) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $nMsg = $Radio1 OR $nMsg = $Radio2 OR $nMsg = $Radio3 OR $nMsg = $Radio4 If BitAND(GuiCtrlread($Radio1), $GUI_CHECKED) OR BitAND(GuiCtrlread($Radio2), $GUI_CHECKED) OR BitAND(GuiCtrlread($Radio3), $GUI_CHECKED) OR BitAND(GuiCtrlread($Radio4),$GUI_CHECKED) Then GUICtrlSetState($Button1,$GUI_ENABLE) else GUICtrlSetState($Button1,$GUI_DISABLE) EndIf Case $Button1 MsgBox(0,"Clicked!","Clicked OK",3) GUICtrlSetState($Radio1,$gui_UNCHECKED) GUICtrlSetState($Radio2,$gui_UNCHECKED) GUICtrlSetState($Radio3,$gui_UNCHECKED) GUICtrlSetState($Radio4,$gui_UNCHECKED) GUICtrlSetState($Button1,$GUI_DISABLE) EndSwitch WEnd
Danyfirex Posted November 27, 2017 Posted November 27, 2017 The correct way is. Case $Radio1, $Radio2, $Radio3, $Radio4 Saludos youtuber and Skysnake 2 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
spudw2k Posted November 27, 2017 Posted November 27, 2017 In your example, you could also do Case $Radio1 To $Radio4 as long as the radio buttons are created in sequence order and no other controls in between (because each control is assigned an integer index which increments by 1 each time). #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 539, 438, 192, 124) $Radio1 = GUICtrlCreateRadio("Radio1", 112, 80, 113, 17) $Radio2 = GUICtrlCreateRadio("Radio2", 112, 120, 113, 17) $Radio3 = GUICtrlCreateRadio("Radio3", 112, 160, 113, 17) $Radio4 = GUICtrlCreateRadio("Radio4", 112, 200, 113, 17) $Button1 = GUICtrlCreateButton("Button1", 112, 272, 75, 25) GUICtrlSetState($Button1, $GUI_DISABLE) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Radio1 To $Radio4 If BitAND(GUICtrlRead($nMsg), $GUI_CHECKED) Then GUICtrlSetState($Button1,$GUI_ENABLE) Else GUICtrlSetState($Button1,$GUI_DISABLE) EndIf Case $Button1 MsgBox(0,"Clicked!","Clicked OK",3) GUICtrlSetState($Radio1,$gui_UNCHECKED) GUICtrlSetState($Radio2,$gui_UNCHECKED) GUICtrlSetState($Radio3,$gui_UNCHECKED) GUICtrlSetState($Radio4,$gui_UNCHECKED) GUICtrlSetState($Button1,$GUI_DISABLE) EndSwitch WEnd However, Danyfirex is right, you'll likely want to evaluate each radio button on it's own. Also, there's not much point evaluating if a radio button is checked if clicking it is what triggered the event, unless I'm not considering / overlooking something? Danyfirex and youtuber 2 Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
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