jfcby Posted September 19, 2008 Share Posted September 19, 2008 Hello,In my script I have 4 tabs and on tab 3 I have 4 radio buttons that show a listview for each one when selected. The problem is when I select a radio button that shows a listview then select another tab the listview is not hidden.I think what I ned to do is Case $msg = $tab with the listview items hidded.How do you select a tab in a case statemnet?I've tried:1. Case $msg = _GUICtrlTab_GetCurSel($tab) but it continues to repeat nonstop.2. Case $msg = $tab1 and nothing happens.3. Case $msg = GUICtrlSetState($tab0, $GUI_SHOW) and it continues to repeat nonstop.How can I insert a case statment into my script to select a tab to perform certain task?Line 84 & 85 has the code below and it continues nonstop.Case $msg = $tabCount If $tabCount = 0 or 1 or 3 or 4 Then HideTab1()Full Code:expandcollapse popup#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <TabConstants.au3> #include <GUITab.au3> #Include <GuiListView.au3> #include <Constants.au3> Opt('MustDeclareVars', 1) Local $tab, $tab0, $tab0About Local $tab1, $tab1OK Local $tab2, $tab2Install, $radio21, $radio22, $radio23, $radio24, $listview21, $item211, $item212, $item213, $item214, _ $listview22, $item221, $item222, $item223, $item224, $listview23, $item231, $item232, $item233, $item234, _ $listview24, $item241, $item242, $item243, $item244 Local $tab3, $tab3Install, $radio31, $radio32, $radio33, $radio34 Local $tab4, $tab4Install, $radio41, $radio42, $radio43, $radio44 Local $msg, $tabCount Main() Func Main() GUICreate("My GUI Tab", 320, 400) ; will create a dialog box that when displayed is centered GUISetBkColor(0xECE9D8) GUISetFont(9, 300) $tab = GUICtrlCreateTab(1, 0, 319, 400) $tab0 = GUICtrlCreateTabItem("About") GUICtrlSetState(-1, $GUI_SHOW) ; will be display first GUICtrlCreateLabel("About", 5, 30, 120, 20) GUICtrlCreateTabItem("") $tab1 = GUICtrlCreateTabItem("Help") GUICtrlCreateLabel("Help", 5, 30, 120, 20) $tab1OK = GUICtrlCreateButton("Help", 265, 375, 50, 20) GUICtrlCreateTabItem("") $tab2 = GUICtrlCreateTabItem("PC Protection") GUICtrlCreateLabel("PC Protection", 5, 30, 120, 20) $tab2Install = GUICtrlCreateButton("Install", 265, 375, 50, 20) $radio21 = GUICtrlCreateRadio("Radio 1", 5, 50, 120, 20) $radio22 = GUICtrlCreateRadio("Radio 2", 5, 70, 120, 20) $radio23 = GUICtrlCreateRadio("Radio 3", 5, 90, 120, 20) $radio24 = GUICtrlCreateRadio("Radio 4", 5, 110, 120, 20) $listview21 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview22 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview23 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview24 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlCreateTabItem("") $tab3 = GUICtrlCreateTabItem("PC Software") GUICtrlCreateLabel("PC Software", 5, 30, 120, 20) $tab3Install = GUICtrlCreateButton("Install", 265, 375, 50, 20) $radio31 = GUICtrlCreateRadio("Radio 1", 5, 50, 120, 20) $radio32 = GUICtrlCreateRadio("Radio 2", 5, 70, 120, 20) $radio33 = GUICtrlCreateRadio("Radio 3", 5, 90, 120, 20) $radio34 = GUICtrlCreateRadio("Radio 4", 5, 110, 120, 20) GUICtrlCreateTabItem("") $tab4 = GUICtrlCreateTabItem("PC Learn") GUICtrlCreateLabel("PC Learn", 5, 30, 120, 20) $tab4Install = GUICtrlCreateButton("Install", 265, 375, 50, 20) $radio41 = GUICtrlCreateRadio("Radio 1", 5, 50, 120, 20) $radio42 = GUICtrlCreateRadio("Radio 2", 5, 70, 120, 20) $radio43 = GUICtrlCreateRadio("Radio 3", 5, 90, 120, 20) $radio44 = GUICtrlCreateRadio("Radio 4", 5, 110, 120, 20) GUICtrlCreateTabItem("") ; end tabitem definition GUISetState() $tabCount = _GUICtrlTab_GetCurSel($tab) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $tabCount If $tabCount = 0 or 1 or 3 or 4 Then HideTab1() Case $msg = $radio21 And BitAND(GUICtrlRead($radio21), $GUI_CHECKED) = $GUI_CHECKED $listview22 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview23 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview24 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview21 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_SHOW) ; Set colors GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE) _GUICtrlListView_RegisterSortCallBack($listview21) $item211 = GUICtrlCreateListViewItem("Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3", $listview21) GUICtrlSetBkColor(-1, 0xE6E6E6) $item212 = GUICtrlCreateListViewItem("Row 2 Col 1 | Row 2 Col 3 | Row 2 Col 3", $listview21) GUICtrlSetBkColor(-1, 0xE6E6E6) $item213 = GUICtrlCreateListViewItem("Row 3 Col 1 | Row 3 Col 2 | Row 3 Col 3", $listview21) GUICtrlSetBkColor(-1, 0xE6E6E6) $item214 = GUICtrlCreateListViewItem("Row 4 Col 1 | Row 4 Col 2 | Row 4 Col 3", $listview21) GUICtrlSetBkColor(-1, 0xE6E6E6) Case $msg = $radio22 And BitAND(GUICtrlRead($radio22), $GUI_CHECKED) = $GUI_CHECKED $listview21 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview23 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview24 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview22 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_SHOW) ; Set colors GUICtrlSetBkColor(-1, 0x6FB052) _GUICtrlListView_RegisterSortCallBack($listview22) $item221 = GUICtrlCreateListViewItem("Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3", $listview22) GUICtrlSetBkColor(-1, 0x6FB052) $item222 = GUICtrlCreateListViewItem("Row 2 Col 1 | Row 2 Col 3 | Row 2 Col 3", $listview22) GUICtrlSetBkColor(-1, 0x6FB052) $item223 = GUICtrlCreateListViewItem("Row 3 Col 1 | Row 3 Col 2 | Row 3 Col 3", $listview22) GUICtrlSetBkColor(-1, 0x6FB052) $item224 = GUICtrlCreateListViewItem("Row 4 Col 1 | Row 4 Col 2 | Row 4 Col 3", $listview22) GUICtrlSetBkColor(-1, 0x6FB052) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE) Case $msg = $radio23 And BitAND(GUICtrlRead($radio23), $GUI_CHECKED) = $GUI_CHECKED $listview21 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview22 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview24 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview23 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_SHOW) GUICtrlSetStyle( $listView23, (GUICtrlSetImage(-1, "shell32.dll", 22)) ) _GUICtrlListView_RegisterSortCallBack($listview23) ; Set colors $item231 = GUICtrlCreateListViewItem("Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3", $listview23) GUICtrlSetImage($listView23, "shell32.dll", 29) $item232 = GUICtrlCreateListViewItem("Row 2 Col 1 | Row 2 Col 3 | Row 2 Col 3", $listview23) GUICtrlSetImage($listView23, "shell32.dll", 30) $item233 = GUICtrlCreateListViewItem("Row 3 Col 1 | Row 3 Col 2 | Row 3 Col 3", $listview23) GUICtrlSetImage($listView23, "shell32.dll", 31) $item234 = GUICtrlCreateListViewItem("Row 4 Col 1 | Row 4 Col 2 | Row 4 Col 3", $listview23) GUICtrlSetImage($listView23, "shell32.dll", 328) Case $msg = $radio24 And BitAND(GUICtrlRead($radio24), $GUI_CHECKED) = $GUI_CHECKED $listview21 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview22 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview23 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetState(-1, $GUI_HIDE) $listview24 = GUICtrlCreateListView("Col 1 | Col 2 | Col 3 ", 80, 130, 200, 150) GUICtrlSetBkColor(-1, 0xFFD6B3) _GUICtrlListView_RegisterSortCallBack($listview24) $item241 = GUICtrlCreateListViewItem("Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3", $listview24) GUICtrlSetBkColor(-1, 0xFFD6B3) $item242 = GUICtrlCreateListViewItem("Row 2 Col 1 | Row 2 Col 3 | Row 2 Col 3", $listview24) GUICtrlSetBkColor(-1, 0xFFD6B3) $item243 = GUICtrlCreateListViewItem("Row 3 Col 1 | Row 3 Col 2 | Row 3 Col 3", $listview24) GUICtrlSetBkColor(-1, 0xFFD6B3) $item244 = GUICtrlCreateListViewItem("Row 4 Col 1 | Row 4 Col 2 | Row 4 Col 3", $listview24) GUICtrlSetBkColor(-1, 0xFFD6B3) Case $msg = $listview21 ;MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview21), 2) _GUICtrlListView_SortItems($listview21, GUICtrlGetState($listview21)) Case $msg = $listview22 ;MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview22), 2) _GUICtrlListView_SortItems($listview22, GUICtrlGetState($listview22)) Case $msg = $listview23 ;MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview23), 2) _GUICtrlListView_SortItems($listview23, GUICtrlGetState($listview23)) Case $msg = $listview24 ;MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview24), 2) _GUICtrlListView_SortItems($listview24, GUICtrlGetState($listview24)) Case $msg = $tab2Install Select Case $radio21 And BitAND(GUICtrlRead($radio21), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 21 and it is Checked.') Select Case $item211 MsgBox(0, "Listview 21 Item:", GUICtrlRead(GUICtrlRead($listview21))) Case $item212 MsgBox(0, "Listview 21 Item", GUICtrlRead(GUICtrlRead($listview21))) Case $item213 MsgBox(0, "Listview 21 Item", GUICtrlRead(GUICtrlRead($listview21))) Case $item214 MsgBox(0, "Listview 21 Item", GUICtrlRead(GUICtrlRead($listview21))) EndSelect Case $radio22 And BitAND(GUICtrlRead($radio22), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 22 and it is Checked.') Select Case $item221 MsgBox(0, "Listview 22 Item:", GUICtrlRead(GUICtrlRead($listview22))) Case $item222 MsgBox(0, "Listview 22 Item", GUICtrlRead(GUICtrlRead($listview22))) Case $item223 MsgBox(0, "Listview 22 Item", GUICtrlRead(GUICtrlRead($listview22))) Case $item224 MsgBox(0, "Listview 22 Item", GUICtrlRead(GUICtrlRead($listview22))) EndSelect Case $radio23 And BitAND(GUICtrlRead($radio23), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 23 and it is Checked.') Select Case $item231 MsgBox(0, "Listview 23 Item:", GUICtrlRead(GUICtrlRead($listview23))) Case $item232 MsgBox(0, "Listview 23 Item", GUICtrlRead(GUICtrlRead($listview23))) Case $item233 MsgBox(0, "Listview 23 Item", GUICtrlRead(GUICtrlRead($listview23))) Case $item234 MsgBox(0, "Listview 23 Item", GUICtrlRead(GUICtrlRead($listview23))) EndSelect Case $radio24 And BitAND(GUICtrlRead($radio24), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 24 and it is Checked.') Select Case $item241 MsgBox(0, "Listview 24 Item:", GUICtrlRead(GUICtrlRead($listview24))) Case $item242 MsgBox(0, "Listview 24 Item", GUICtrlRead(GUICtrlRead($listview24))) Case $item243 MsgBox(0, "Listview 24 Item", GUICtrlRead(GUICtrlRead($listview24))) Case $item244 MsgBox(0, "Listview 24 Item", GUICtrlRead(GUICtrlRead($listview24))) EndSelect EndSelect Case $msg = $tab3Install Select Case $radio31 And BitAND(GUICtrlRead($radio31), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 31 and it is Checked.') Case $radio32 And BitAND(GUICtrlRead($radio32), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 32 and it is Checked.') Case $radio33 And BitAND(GUICtrlRead($radio33), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 33 and it is Checked.') Case $radio34 And BitAND(GUICtrlRead($radio34), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 34 and it is Checked.') EndSelect Case $msg = $tab4Install Select Case $radio41 And BitAND(GUICtrlRead($radio41), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 41 and it is Checked.') Case $radio42 And BitAND(GUICtrlRead($radio42), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 42 and it is Checked.') Case $radio43 And BitAND(GUICtrlRead($radio43), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 43 and it is Checked.') Case $radio44 And BitAND(GUICtrlRead($radio44), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 44 and it is Checked.') EndSelect EndSelect WEnd _GUICtrlListView_UnRegisterSortCallBack($listview21) _GUICtrlListView_UnRegisterSortCallBack($listview22) _GUICtrlListView_UnRegisterSortCallBack($listview23) _GUICtrlListView_UnRegisterSortCallBack($listview24) EndFunc ;==>Example Func HideTab1() MsgBox(0, "Test", "Test") GUICtrlSetState($listview21, $GUI_HIDE) GUICtrlSetState($listview22, $GUI_HIDE) GUICtrlSetState($listview23, $GUI_HIDE) GUICtrlSetState($listview24, $GUI_HIDE) EndFuncThank you for your help,jfcby Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB **** Link to comment Share on other sites More sharing options...
oren Posted September 19, 2008 Share Posted September 19, 2008 maybe try using GUISwitch I'm sorry but you script is too big so I could try to fix it... If you can do it smaller maybe i could try to fix it.. Link to comment Share on other sites More sharing options...
jfcby Posted September 19, 2008 Author Share Posted September 19, 2008 maybe try using GUISwitch I'm sorry but you script is too big so I could try to fix it... If you can do it smaller maybe i could try to fix it.. Problem solved with: Case $msg = $tab $tabCount = GUICtrlRead($tab)+1 Thank you for your help, jfcby Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB **** 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