soonyee91 Posted June 11, 2013 Share Posted June 11, 2013 (edited) Basically I have no idea to proceed from here. Any tips on doing it? I'm able to perform function on selected checkbox but when I implement tab item. I want: Tab1: when select function 1,2,3, it will perform function Tab2: when select function 4,5,6, it will perform function Tab3: when select function 7,8,9, it will perform function The problem I encounter is when I have select Tab 1 function 1,2,3 and go to Tab 2 and selected function 4,5,6. The code will perform function on 1,2,3,4,5,6. How to perform function only based on tab item? Is my explanation clear? What I mean is to on Tab 1. I only want to perform function 1,2,3 but not 4,5,6,7,8,9 Below is my code for what I've described: expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiButton.au3> Example() Func Example() Local $tab Local $msg GUICreate("My GUI Tab", 500, 500); will create a dialog box that when displayed is centered $btn_perform = GUICtrlCreateButton("Perform", 150, 420) $tab = GUICtrlCreateTab(10, 10, 400, 400) $t1 = GUICtrlCreateTabItem("tab1") $f1 = GUICtrlCreateCheckbox(" 1", 30, 260) $f2 = GUICtrlCreateCheckbox(" 2", 30, 280) $f3 = GUICtrlCreateCheckbox(" 3", 30, 300) $t2 = GUICtrlCreateTabItem("tab2") $f4 = GUICtrlCreateCheckbox(" 4", 30, 260) $f5 = GUICtrlCreateCheckbox(" 5", 30, 280) $f6 = GUICtrlCreateCheckbox(" 6", 30, 300) $t3 = GUICtrlCreateTabItem("tab3") $f7 = GUICtrlCreateCheckbox(" 7", 30, 260) $f8 = GUICtrlCreateCheckbox(" 8", 30, 280) $f9 = GUICtrlCreateCheckbox(" 9", 30, 300) GUICtrlCreateTabItem(""); end tabitem definition GUISetState() ; Run the GUI until the dialog is closed While 1 $st1 = _GUICtrlButton_GetCheck($f1) $st2 = _GUICtrlButton_GetCheck($f2) $st3 = _GUICtrlButton_GetCheck($f3) $st4 = _GUICtrlButton_GetCheck($f4) $st5 = _GUICtrlButton_GetCheck($f5) $st6 = _GUICtrlButton_GetCheck($f6) $st7 = _GUICtrlButton_GetCheck($f7) $st8 = _GUICtrlButton_GetCheck($f8) $st9 = _GUICtrlButton_GetCheck($f9) $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $btn_perform If $st1 = 1 Then MsgBox("", "", "1") EndIf If $st2 = 1 Then MsgBox("", "", "2") EndIf If $st3 = 1 Then MsgBox("", "", "3") EndIf If $st4 = 1 Then MsgBox("", "", "4") EndIf If $st5 = 1 Then MsgBox("", "", "5") EndIf If $st6 = 1 Then MsgBox("", "", "6") EndIf If $st7 = 1 Then MsgBox("", "", "7") EndIf If $st8 = 1 Then MsgBox("", "", "8") EndIf If $st9 = 1 Then MsgBox("", "", "9") EndIf EndSwitch WEnd EndFunc Edited June 11, 2013 by soonyee91 Link to comment Share on other sites More sharing options...
Xenobiologist Posted June 11, 2013 Share Posted June 11, 2013 expandcollapse popup#region ;************ Includes ************ #include <GuiTab.au3> #include <GUIConstantsEx.au3> #include <GuiButton.au3> #endregion ;************ Includes ************ Example() Func Example() Local $tab Local $msg GUICreate("My GUI Tab", 500, 500); will create a dialog box that when displayed is centered $btn_perform = GUICtrlCreateButton("Perform", 150, 420) $tab = GUICtrlCreateTab(10, 10, 400, 400) $t1 = GUICtrlCreateTabItem("tab1") $f1 = GUICtrlCreateCheckbox(" 1", 30, 260) $f2 = GUICtrlCreateCheckbox(" 2", 30, 280) $f3 = GUICtrlCreateCheckbox(" 3", 30, 300) $t2 = GUICtrlCreateTabItem("tab2") $f4 = GUICtrlCreateCheckbox(" 4", 30, 260) $f5 = GUICtrlCreateCheckbox(" 5", 30, 280) $f6 = GUICtrlCreateCheckbox(" 6", 30, 300) $t3 = GUICtrlCreateTabItem("tab3") $f7 = GUICtrlCreateCheckbox(" 7", 30, 260) $f8 = GUICtrlCreateCheckbox(" 8", 30, 280) $f9 = GUICtrlCreateCheckbox(" 9", 30, 300) GUICtrlCreateTabItem(""); end tabitem definition GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $btn_perform $st1 = _GUICtrlButton_GetCheck($f1) $st2 = _GUICtrlButton_GetCheck($f2) $st3 = _GUICtrlButton_GetCheck($f3) $st4 = _GUICtrlButton_GetCheck($f4) $st5 = _GUICtrlButton_GetCheck($f5) $st6 = _GUICtrlButton_GetCheck($f6) $st7 = _GUICtrlButton_GetCheck($f7) $st8 = _GUICtrlButton_GetCheck($f8) $st9 = _GUICtrlButton_GetCheck($f9) $t = _GUICtrlTab_GetCurSel($tab) ConsoleWrite($t) Switch $t Case 0 If $st1 = 1 Then MsgBox("", "", "1") EndIf If $st2 = 1 Then MsgBox("", "", "2") EndIf If $st3 = 1 Then MsgBox("", "", "3") EndIf Case 1 If $st4 = 1 Then MsgBox("", "", "4") EndIf If $st5 = 1 Then MsgBox("", "", "5") EndIf If $st6 = 1 Then MsgBox("", "", "6") EndIf Case 2 If $st7 = 1 Then MsgBox("", "", "7") EndIf If $st8 = 1 Then MsgBox("", "", "8") EndIf If $st9 = 1 Then MsgBox("", "", "9") EndIf EndSwitch EndSwitch WEnd EndFunc ;==>Example Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
FireFox Posted June 11, 2013 Share Posted June 11, 2013 (edited) Also, better use GUICtrlRead instead of _GUICtrlButton_GetCheck (and $GUI_CHECKED/UNCHECKED for the state).Br, FireFox. Edited June 11, 2013 by FireFox Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted June 11, 2013 Moderators Solution Share Posted June 11, 2013 (edited) soonyee91, Just check the boxes which appear on the current tab: expandcollapse popup#include <GUIConstantsEx.au3> Example() Func Example() Local $tab Local $msg GUICreate("My GUI Tab", 500, 500); will create a dialog box that when displayed is centered $btn_perform = GUICtrlCreateButton("Perform", 150, 420) $tab = GUICtrlCreateTab(10, 10, 400, 400) $t1 = GUICtrlCreateTabItem("tab1") $f1 = GUICtrlCreateCheckbox(" 1", 30, 260) $f2 = GUICtrlCreateCheckbox(" 2", 30, 280) $f3 = GUICtrlCreateCheckbox(" 3", 30, 300) $t2 = GUICtrlCreateTabItem("tab2") $f4 = GUICtrlCreateCheckbox(" 4", 30, 260) $f5 = GUICtrlCreateCheckbox(" 5", 30, 280) $f6 = GUICtrlCreateCheckbox(" 6", 30, 300) $t3 = GUICtrlCreateTabItem("tab3") $f7 = GUICtrlCreateCheckbox(" 7", 30, 260) $f8 = GUICtrlCreateCheckbox(" 8", 30, 280) $f9 = GUICtrlCreateCheckbox(" 9", 30, 300) GUICtrlCreateTabItem(""); end tabitem definition GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $btn_perform Switch GUICtrlRead($tab) Case 0 If GUICtrlRead($f1) = 1 Then MsgBox("", "", "1") EndIf If GUICtrlRead($f2) = 1 Then MsgBox("", "", "2") EndIf If GUICtrlRead($f3) = 1 Then MsgBox("", "", "3") EndIf Case 1 If GUICtrlRead($f4) = 1 Then MsgBox("", "", "4") EndIf If GUICtrlRead($f5) = 1 Then MsgBox("", "", "5") EndIf If GUICtrlRead($f6) = 1 Then MsgBox("", "", "6") EndIf Case 2 If GUICtrlRead($f7) = 1 Then MsgBox("", "", "7") EndIf If GUICtrlRead($f8) = 1 Then MsgBox("", "", "8") EndIf If GUICtrlRead($f9) = 1 Then MsgBox("", "", "9") EndIf EndSwitch EndSwitch WEnd EndFunc All clear? M23 Edit: Well it must the good solution as so many of us have posted it! Edited June 11, 2013 by Melba23 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...
soonyee91 Posted June 11, 2013 Author Share Posted June 11, 2013 Thanks for so many solution!!!! Appreciate alot! 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