realcapone Posted July 24, 2015 Share Posted July 24, 2015 Hi everyone. I just need a little help on how to set the state for the radio buttons or a checkbox to "Unchecked" whenever I select a different tab in the form. I run the functions from a single "Run" button as you can see from the codes below. Need your help please. Thanks.GUICtrlSetState ( controlID, state ) ; I understand this but I'm not sure how to trigger it when a certain tab is selected While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Run If GUICtrlRead($JRT) = 1 Then ;Radio button in the Main Tab _JRT() ElseIf GUICtrlRead($CCleaner) = 1 Then ;Radio button in the Main Tab _Ccleaner() ElseIf GUICtrlRead($Msconfig) = 1 Then ;Checbox in the second tab _Msconfig() ElseIf GUICtrlRead($TaskSched) = 1 Then ;Checbox in the second tab _TaskScheduler() ElseIf GUICtrlRead($RestorePoint) = 1 Then ;Checbox in the second tab _CreateRestorePoint() EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 24, 2015 Moderators Share Posted July 24, 2015 realcapone,A couple of suggestions - which are a bit "belt and braces" as either should solve the problem:- 1. Clear the controls when the tab control itself is actioned.- 2. Check which tab is active and only check the relevant controls when you action the button.Here is an example:expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cTab = GUICtrlCreateTab(10, 10, 400, 200) $cTab_0 = GUICtrlCreateTabItem("Tab 0") $cCheck_0 = GUICtrlCreateCheckbox("Check 0", 50, 50, 100, 20) $cTab_1 = GUICtrlCreateTabItem("Tab 1") $cCheck_1 = GUICtrlCreateCheckbox("Check 1", 100, 100, 100, 20) GUICtrlCreateTabItem("") $cRun = GUICtrlCreateButton("Run", 10, 450, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cTab ; Clear all chekboxes _Clear_All() Case $cRun ; Which tab is selected? $iTabIndex = GUICtrlRead($cTab) ; Just check the controls on that tab Switch $iTabIndex Case 0 If GUICtrlRead($cCheck_0) = $GUI_CHECKED Then ; Do something EndIf Case 1 If GUICtrlRead($cCheck_1) = $GUI_CHECKED Then ; Do something else EndIf EndSwitch EndSwitch WEnd Func _Clear_All() ; Clear all controls GUICtrlSetState($cCheck_0, $GUI_UNCHECKED) GUICtrlSetState($cCheck_1, $GUI_UNCHECKED) EndFuncPlease ask if you have any questions.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...
realcapone Posted July 24, 2015 Author Share Posted July 24, 2015 Hi M23, ClearAll works perfect and I have also tried the second option by copy/pasting your code and it works great. I have yet to try it with my own code but I think it should work fine. I'll check back here once I'm at home to test it and post some questions if ever I have one. Thanks a lot. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 24, 2015 Moderators Share Posted July 24, 2015 realcapone,Glad I could help and do not hesitate to come back if you do find a problem.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...
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