Rfsvieira Posted December 12, 2015 Posted December 12, 2015 Hello, i was working in two tipes of design have difirent problems for the same design1st one i was making child gui for all tabs and sub tabs-problems:to big the code, for the tab1 its go back, but tab 2 doesn t move if for item 3, but i have to declarate 20 child guis in the end if it of course not now2nd one i make child guid only for the sub tabsproblems:doesnt go back from tab 1 to tab, and from tab2 to tab1, wen enter in tab1 doesnt charge the buttons, only if i click in outher tab item and go back the button appearCODE 1 - BIG MESSI expandcollapse popup#include <GuiTab.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> $GUI = GUICreate("", 450, 600, 0, 0); BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX)) ;GUICtrlCreateMenu("") ;GUISetBkColor(0x940F1B) GUISetIcon("hunosicon.ico") $Pic1 = GUICtrlCreatePic("img\App\barra.jpg", 0, 0, 450, 120) $Button1 = GUICtrlCreateButton("FIRST TAB ITEM A", 0, 580, 450, 20) $Tab = GUICtrlCreateTab(1,120) GUICtrlCreateTabItem("A") ;GUICtrlSetState(-1, $GUI_SHOW) GUICtrlCreateTabItem("B") GUICtrlCreateTabItem("C") GUICtrlCreateTabItem("D") GUICtrlCreateTabItem("E") GUICtrlCreateTabItem("") GUISetState() ; //////////////////////////////A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ $GUI_Child_1 = GUICreate("", 450, 440, 0, 140, BitOR($WS_POPUP, 0), $WS_EX_MDICHILD, $GUI) GUISetBkColor(0xE0A652) GUISetState(@SW_SHOW) ; //////////////////////////////B\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ $GUI_Child_2 = GUICreate("", 450, 440, 0, 140, BitOR($WS_POPUP, 1), $WS_EX_MDICHILD, $GUI) GUISetBkColor(0xAAAAAAA) GUISetState(@SW_HIDE) ; //////////////////////////////C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ $GUI_Child_3 = GUICreate("", 445, 440, 0, 140, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $GUI) GUISetBkColor(0xAAAEEAA) GUISetState(@SW_HIDE) ; //////////////////////////////D\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ $GUI_Child_4 = GUICreate("", 445, 440, 0, 120, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $GUI) GUISetBkColor(0xAAAEEAA) $Tab1 = GUICtrlCreateTab(0,0,455,440,$tcs_buttons) _GUICtrlTab_SetBkColor($GUI_Child_4, $Tab1, 0xFFCCCC) GUICtrlCreateTabItem("<----") GUICtrlCreateTabItem("11") GUICtrlCreateTabItem("22") GUICtrlCreateTabItem("33") GUICtrlCreateTabItem("44") GUICtrlCreateTabItem("55") GUICtrlCreateTabItem("66") GUICtrlCreateTabItem("") GUISetState(@SW_HIDE) ; //////////////////////////////E\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ $GUI_Child_5 = GUICreate("", 445, 440, 0, 140, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $GUI) GUISetBkColor(0xAAAEEAA) GUISetState(@SW_HIDE) ; //////////////////////////////11\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ $GUI_Child_6 = GUICreate("", 445, 440, 0, 120, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $GUI) GUISetBkColor(0xAAAE6AA) $Tab2 = GUICtrlCreateTab(0,0,455,440,$tcs_buttons) _GUICtrlTab_SetBkColor($GUI_Child_6, $Tab2, 0xFFAACC) GUICtrlCreateTabItem("<----") GUICtrlCreateTabItem("H2O") GUICtrlCreateTabItem("CO2") GUICtrlCreateTabItem("H2") GUICtrlCreateTabItem("O2") GUICtrlCreateTabItem("") GUISetState(@SW_HIDE) ; //////////////////////////////22\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ $GUI_Child_7 = GUICreate("", 445, 440, 0, 140, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $GUI) GUISetBkColor(0xAAAEEAA) GUISetState(@SW_HIDE) While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $Tab $SelTab = _GUICtrlTab_GetCurSel($Tab) _GUICtrlTab_SetCurSel($Tab1, 2) ;_GUICtrlTab_SetCurSel($Tab2, 1) Switch $SelTab Case 0 ;A GUISetState(@SW_HIDE,$GUI_Child_7) GUISetState(@SW_HIDE,$GUI_Child_6) GUISetState(@SW_HIDE,$GUI_Child_5) GUISetState(@SW_HIDE,$GUI_Child_4) GUISetState(@SW_HIDE,$GUI_Child_3) GUISetState(@SW_HIDE,$GUI_Child_2) GUISetState(@SW_SHOW,$GUI_Child_1) Case 1 ;B GUISetState(@SW_HIDE,$GUI_Child_7) GUISetState(@SW_HIDE,$GUI_Child_6) GUISetState(@SW_HIDE,$GUI_Child_5) GUISetState(@SW_HIDE,$GUI_Child_1) GUISetState(@SW_SHOW,$GUI_Child_2) GUISetState(@SW_HIDE,$GUI_Child_3) GUISetState(@SW_HIDE,$GUI_Child_4) Case 2 ;C GUISetState(@SW_HIDE,$GUI_Child_7) GUISetState(@SW_HIDE,$GUI_Child_6) GUISetState(@SW_HIDE,$GUI_Child_5) GUISetState(@SW_HIDE,$GUI_Child_4) GUISetState(@SW_SHOW,$GUI_Child_3) GUISetState(@SW_HIDE,$GUI_Child_2) GUISetState(@SW_HIDE,$GUI_Child_1) Case 3 ;D GUISetState(@SW_HIDE,$GUI_Child_7) GUISetState(@SW_HIDE,$GUI_Child_6) GUISetState(@SW_HIDE,$GUI_Child_5) GUISetState(@SW_SHOW,$GUI_Child_4) GUISetState(@SW_HIDE,$GUI_Child_3) GUISetState(@SW_HIDE,$GUI_Child_2) GUISetState(@SW_HIDE,$GUI_Child_1) Case 4 ;E GUISetState(@SW_HIDE,$GUI_Child_7) GUISetState(@SW_HIDE,$GUI_Child_6) GUISetState(@SW_SHOW,$GUI_Child_5) GUISetState(@SW_HIDE,$GUI_Child_4) GUISetState(@SW_HIDE,$GUI_Child_3) GUISetState(@SW_HIDE,$GUI_Child_2) GUISetState(@SW_HIDE,$GUI_Child_1) EndSwitch Case $Tab1 ; NUMBERS Tab $SelTab1 = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab2, 1) Switch $SelTab1 Case 0 _GUICtrlTab_ClickTab($Tab, 0, "left", False, 1, 100) Case 1 ;11 GUISetState(@SW_HIDE,$GUI_Child_7) GUISetState(@SW_SHOW,$GUI_Child_6) GUISetState(@SW_HIDE,$GUI_Child_5) GUISetState(@SW_HIDE,$GUI_Child_4) GUISetState(@SW_HIDE,$GUI_Child_3) GUISetState(@SW_HIDE,$GUI_Child_2) GUISetState(@SW_HIDE,$GUI_Child_1) Case 2; 22 GUISetState(@SW_SHOW,$GUI_Child_7) GUISetState(@SW_HIDE,$GUI_Child_6) GUISetState(@SW_HIDE,$GUI_Child_5) GUISetState(@SW_HIDE,$GUI_Child_4) GUISetState(@SW_HIDE,$GUI_Child_3) GUISetState(@SW_HIDE,$GUI_Child_2) GUISetState(@SW_HIDE,$GUI_Child_1) EndSwitch Case $Tab2 ; TABLE PER $SelTab2 = _GUICtrlTab_GetCurSel($Tab2) ;_GUICtrlTab_SetCurSel($Tab1, 2) Switch $SelTab2 Case 0 ;MsgBox("0", "tttt", "hehhheh") _GUICtrlTab_ClickTab($Tab, 3, "left", False, 1, 100); IF I CHANGE TO 2 IT MOVE EndSwitch Case $Button1 _GUICtrlTab_ClickTab($Tab, 0, "left", False, 1, 100) EndSwitch WEnd Func _GUICtrlTab_SetBkColor($hWnd, $hSysTab32, $sBkColor) Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32) Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1) GUICtrlCreateLabel("", $aTabPos[0]+2, $aTabPos[1]+$aTab_Rect[3]+4, $aTabPos[2]-6, $aTabPos[3]-$aTab_Rect[3]-7) GUICtrlSetBkColor(-1, $sBkColor) GUICtrlSetState(-1, $GUI_DISABLE) EndFuncCODE 2 I THINK IS THE BETHER OPTION IF WORKSexpandcollapse popup#include <GuiTab.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> ; //////////////////////////////MENU\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ; $GUI = GUICreate("", 450, 600, 0, 0); BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX)) ;GUICtrlCreateMenu("") ;GUISetBkColor(0x940F1B) GUISetIcon("hunosicon.ico") $Pic1 = GUICtrlCreatePic("img\App\barra.jpg", 0, 0, 450, 120) $Button1 = GUICtrlCreateButton("BACK TO GUI", 0, 580, 450, 20); TESTE BUTON $Tab = GUICtrlCreateTab(1,120) GUICtrlCreateTabItem("A") $Button1 = GUICtrlCreateButton("AAAAAAA", 16, 254, 75, 25) ;GUICtrlSetState(-1, $GUI_SHOW) GUICtrlCreateTabItem("B") $Button2 = GUICtrlCreateButton("BBBBBBBB", 16, 254, 75, 25) GUICtrlCreateTabItem("C") GUICtrlCreateTabItem("D") GUICtrlCreateTabItem("E") GUICtrlCreateTabItem("") GUISetState() ; //////////////////////////////MENU1\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ $GUI_Child_1 = GUICreate("", 450, 440, 0, 120, BitOR($WS_POPUP, 0), $WS_EX_MDICHILD, $GUI) ;GUISetBkColor(0xE0A652) $Tab1 = GUICtrlCreateTab(0,0,455,440,$tcs_buttons) ; _GUICtrlTab_SetBkColor($GUI_Child_1, $Tab1, 0xFFCCCC) GUICtrlCreateTabItem("<----") GUICtrlCreateTabItem("11") GUICtrlCreateTabItem("22") $Button3 = GUICtrlCreateButton("222222", 16, 254, 75, 25) GUICtrlCreateTabItem("33") GUICtrlCreateTabItem("44") GUICtrlCreateTabItem("55") GUICtrlCreateTabItem("66") GUICtrlCreateTabItem("") GUISetState(@SW_HIDE) ; //////////////////////////////MENU 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ;<---, CASTELO PRINCIPAL, PA1, PA2, PA3 $GUI_Child_2 = GUICreate("", 445, 440, 0, 120, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $GUI) ;GUISetBkColor(0xAAAE6AA) $Tab2 = GUICtrlCreateTab(0,0,455,440,$tcs_buttons) ; _GUICtrlTab_SetBkColor($GUI_Child_2, $Tab2, 0xFFAACC) GUICtrlCreateTabItem("<----") GUICtrlCreateTabItem("H2O") $Button4 = GUICtrlCreateButton("WATER C", 16, 254, 75, 25) GUICtrlCreateTabItem("CO2") GUICtrlCreateTabItem("H2") GUICtrlCreateTabItem("02") GUICtrlCreateTabItem("") GUISetState(@SW_HIDE) While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $Tab $SelTab = _GUICtrlTab_GetCurSel($Tab) _GUICtrlTab_SetCurSel($Tab1, 2) ;_GUICtrlTab_SetCurSel($Tab2, 1) Switch $SelTab Case 3 GUISetState(@SW_HIDE,$GUI_Child_2) GUISetState(@SW_SHOW,$GUI_Child_1) EndSwitch Case $Tab1 ; $SelTab1 = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab2, 1) Switch $SelTab1 Case 0 ;MsgBox("0", "tttt", "hehhheh") _GUICtrlTab_ClickTab($Tab, 0, "left", False, 1, 100); GO BACK TO MENU Case 1 GUISetState(@SW_SHOW,$GUI_Child_2) GUISetState(@SW_HIDE,$GUI_Child_1) EndSwitch Case $Tab2 ; $SelTab2 = _GUICtrlTab_GetCurSel($Tab2) ;_GUICtrlTab_SetCurSel($Tab1, 2) Switch $SelTab2 Case 0 ;MsgBox("0", "tttt", "h55555") _GUICtrlTab_ClickTab($Tab, 0, "left", False, 1, 100); GO BACK TO MENU1 EndSwitch Case $Button1 _GUICtrlTab_ClickTab($Tab, 0, "left", False, 1, 100) EndSwitch WEnd Func _GUICtrlTab_SetBkColor($hWnd, $hSysTab32, $sBkColor) Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32) Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1) GUICtrlCreateLabel("", $aTabPos[0]+2, $aTabPos[1]+$aTab_Rect[3]+4, $aTabPos[2]-6, $aTabPos[3]-$aTab_Rect[3]-7) GUICtrlSetBkColor(-1, $sBkColor) GUICtrlSetState(-1, $GUI_DISABLE) EndFuncAny idea?I have been Reading a lot of the help file and web, but didnt get Thanks
aa2zz6 Posted December 12, 2015 Posted December 12, 2015 (edited) Here is a fully functional script that I believe is what you are looking for. Feel free to examine this against yours. Let me know if this what your looking for.expandcollapse popup#include <GUIConstantsEx.au3> Example() Func Example() GUICreate("My GUI Tab", 250, 150); will create a dialog box that when displayed is centered GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) Local $idTab = GUICtrlCreateTab(10, 10, 200, 100) GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) GUICtrlCreateButton("OK0", 20, 50, 50, 20) GUICtrlCreateInput("default", 80, 50, 70, 20) GUICtrlCreateTabItem("tab----1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) GUICtrlCreateCombo("", 20, 50, 60, 120) GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo|guinness", "Jon"); default Jon GUICtrlCreateButton("OK1", 80, 50, 50, 20) GUICtrlCreateTabItem("tab2") GUICtrlSetState(-1, $GUI_SHOW); will be display first GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem("tab3") GUICtrlSetState(-1, $GUI_SHOW); will be display first GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem("tab4") GUICtrlSetState(-1, $GUI_SHOW); will be display first GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem("tab5") GUICtrlSetState(-1, $GUI_SHOW); will be display first GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem(""); end tab item definition GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20) GUISetState(@SW_SHOW) Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop If $idMsg = $idTab Then ; display the clicked tab WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($idTab)) EndIf WEnd EndFunc ;==>Example Edited December 12, 2015 by aa2zz6
Moderators Melba23 Posted December 12, 2015 Moderators Posted December 12, 2015 (edited) Rfsvieira,This semi-complete example shows how you might do what I think you want:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TabConstants.au3> $hGUI = GUICreate("Test", 450, 600) $cButton_Main_1 = GUICtrlCreateButton("BACK TO GUI", 0, 580, 450, 20) GUISetState() $hGUI_Tab_Main = GUICreate("", 450, 460, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) $cTab_Main = GUICtrlCreateTab(0, 0, 450, 460) GUICtrlCreateTabItem("A") $cButton_Tab_1 = GUICtrlCreateButton("AAAAAAA", 16, 254, 75, 25) GUICtrlCreateTabItem("B") $cButton_Tab_2 = GUICtrlCreateButton("BBBBBBB", 16, 254, 75, 25) GUICtrlCreateTabItem("C") GUICtrlCreateTabItem("D") GUICtrlCreateTabItem("E") GUICtrlCreateTabItem("") GUISetState() $hGUI_Tab_Sub_D = GUICreate("", 450, 460, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) $cTab_Sub_D = GUICtrlCreateTab(0 , 0, 450, 460, $TCS_BUTTONS) GUICtrlCreateTabItem("<----") GUICtrlCreateTabItem("11") GUICtrlSetState(-1, $GUI_SHOW) GUICtrlCreateTabItem("22") $cButton_Sub_D_1 = GUICtrlCreateButton("222222", 16, 254, 75, 25) GUICtrlCreateTabItem("33") GUICtrlCreateTabItem("44") GUICtrlCreateTabItem("55") GUICtrlCreateTabItem("66") GUICtrlCreateTabItem("") GUISetState(@SW_HIDE) $hGUI_Tab_Sub_D_11 = GUICreate("", 450, 460, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) $cTab_Sub_D_11 = GUICtrlCreateTab(0 , 0, 450, 460, $TCS_BUTTONS) GUICtrlCreateTabItem("<----") GUICtrlCreateTabItem("H2O") $bButton_Sub_D_11_1 = GUICtrlCreateButton("WATER C", 16, 254, 75, 25) GUICtrlCreateTabItem("CO2") GUICtrlCreateTabItem("H2") GUICtrlCreateTabItem("02") GUICtrlCreateTabItem("") GUISetState(@SW_HIDE) While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] ; Main GUI Case $hGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit Case $cButton_Main_1 GUISetState(@SW_HIDE, $hGUI_Tab_Sub_D) GUISetState(@SW_SHOW, $hGUI_Tab_Main) EndSwitch ; Main Tab GUI Case $hGUI_Tab_Main Switch $aMsg[0] Case $cTab_Main Switch GUICtrlRead($cTab_Main) Case 3 GUISetState(@SW_HIDE, $hGUI_Tab_Main) GUISetState(@SW_SHOW, $hGUI_Tab_Sub_D) EndSwitch EndSwitch ; Sub_D GUI Case $hGUI_Tab_Sub_D Switch $aMsg[0] Case $cTab_Sub_D Switch GUICtrlRead($cTab_Sub_D) Case 0 GUISetState(@SW_HIDE, $hGUI_Tab_Sub_D) GUISetState(@SW_SHOW, $hGUI_Tab_Main) Case 1 GUISetState(@SW_HIDE, $hGUI_Tab_Sub_D) GUISetState(@SW_SHOW, $hGUI_Tab_Sub_D_11) EndSwitch EndSwitch ; Sub_D GUI Case $hGUI_Tab_Sub_D_11 Switch $aMsg[0] Case $cTab_Sub_D_11 Switch GUICtrlRead($cTab_Sub_D_11) Case 0 GUISetState(@SW_HIDE, $hGUI_Tab_Sub_D_11) GUISetState(@SW_SHOW, $hGUI_Tab_Sub_D) EndSwitch EndSwitch EndSwitch WEndBut I would strongly advise you to rethink how you want to construct this GUI. As you can see the code is complex with just a couple of active tabs - if you have to add child GUIs for each possible tab combination you will end up with some seriously complicated Switch spaghetti to maintain.Perhaps something with linked combos which load the dependent combos with the correct selections might be a better idea - that way you will only need to load a single "content" and make things a lot simpler. I will see what I can come up with this morning.M23EditI have tried coding something with combos but you still end up with a real mess when you start adding controls to each of the possible "content" pages - as there are so many possible combinations the idle loop to check for each control in each one becomes seriously large and difficult to maintain.Can you describe what you are trying to do with this script? Perhaps if we understood the overall aim we could suggest something simpler to get the same result. Edited December 12, 2015 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
Rfsvieira Posted December 12, 2015 Author Posted December 12, 2015 Hello, thanks for your timeNow im trying to work into the design, because i was making the code but with out the designt i cant aplly right The idea is to have 1 window program that will control all "variables" / choices in A the check boxs, B and C, will have some comboboxs that will choice the itens (with image) by sequence. (have it working allredy the A/B , and C +/- stoped the tests because the designD, will open sub tab/gui numbers ....111 - 222- .... for aply that sequence with vários comboboxs again and some checkboxs, the 111, is subtab because is sub divided in 3, it can be in the Subtab numbers because its the same thing, but i add new sub because the space off the window, and to be bether in the design more user friendlythe <---- tab is the go back i add ------_GUICtrlTab_SetCurSel($cTab_Sub_D, 2) ;Pre selection of the tab 3 in menu Sub_D GUI------- to define/force the position wen go back, because wen i click D it has to open the numbers option, and if i go back to D again it opens D and D is empty is like a button to numbers.But wen i add it, it doesnt charge the buttons wen open i have add to the code you send to me but have the same problema before expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TabConstants.au3> #include <GUIConstantsEx.au3> #include <GuiTab.au3> $hGUI = GUICreate("Test", 450, 600) $cButton_Main_1 = GUICtrlCreateButton("BACK TO GUI", 0, 580, 450, 20) GUISetState() $hGUI_Tab_Main = GUICreate("", 450, 460, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) $cTab_Main = GUICtrlCreateTab(0, 0, 450, 460) GUICtrlCreateTabItem("A") GUICtrlSetState(-1, $GUI_SHOW) $cButton_Tab_1 = GUICtrlCreateButton("AAAAAAA", 16, 254, 75, 25) GUICtrlCreateTabItem("B") $cButton_Tab_2 = GUICtrlCreateButton("BBBBBBB", 16, 254, 75, 25) GUICtrlCreateTabItem("C") GUICtrlCreateTabItem("D") GUICtrlCreateTabItem("E") GUICtrlCreateTabItem("") GUISetState() $hGUI_Tab_Sub_D = GUICreate("", 450, 460, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) $cTab_Sub_D = GUICtrlCreateTab(0 , 0, 450, 460, $TCS_BUTTONS) GUICtrlCreateTabItem("<----") GUICtrlCreateTabItem("11") GUICtrlSetState(-1, $GUI_SHOW) GUICtrlCreateTabItem("22") $cButton_Sub_D_1 = GUICtrlCreateButton("222222", 16, 254, 75, 25) ;DOESN´T APPEEAR :( GUICtrlCreateTabItem("33") GUICtrlCreateTabItem("44") GUICtrlCreateTabItem("55") GUICtrlCreateTabItem("66") GUICtrlCreateTabItem("") GUISetState(@SW_HIDE) $hGUI_Tab_Sub_D_11 = GUICreate("", 450, 460, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) $cTab_Sub_D_11 = GUICtrlCreateTab(0 , 0, 450, 460, $TCS_BUTTONS) GUICtrlCreateTabItem("<----") GUICtrlCreateTabItem("H2O") GUICtrlSetState(-1, $GUI_SHOW) $bButton_Sub_D_11_1 = GUICtrlCreateButton("WATER C", 16, 254, 75, 25) GUICtrlCreateTabItem("CO2") GUICtrlCreateTabItem("H2") GUICtrlCreateTabItem("02") GUICtrlCreateTabItem("") GUISetState(@SW_HIDE) While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] ; Main GUI Case $hGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit Case $cButton_Main_1 GUISetState(@SW_HIDE, $hGUI_Tab_Sub_D) GUISetState(@SW_SHOW, $hGUI_Tab_Main) EndSwitch ; Main Tab GUI Case $hGUI_Tab_Main _GUICtrlTab_SetCurSel($cTab_Sub_D, 2) ;Pre selection of the tab 3 in menu Sub_D GUI Switch $aMsg[0] Case $cTab_Main Switch GUICtrlRead($cTab_Main) Case 3 GUISetState(@SW_HIDE, $hGUI_Tab_Main) GUISetState(@SW_SHOW, $hGUI_Tab_Sub_D) EndSwitch EndSwitch ; Sub_D GUI Case $hGUI_Tab_Sub_D _GUICtrlTab_SetCurSel($cTab_Sub_D_11, 1) ;Pre selection of the tab 2 in menu Sub_D_11 GUI Switch $aMsg[0] Case $cTab_Sub_D Switch GUICtrlRead($cTab_Sub_D) Case 0 GUISetState(@SW_HIDE, $hGUI_Tab_Sub_D) GUISetState(@SW_SHOW, $hGUI_Tab_Main) Case 1 GUISetState(@SW_HIDE, $hGUI_Tab_Sub_D) GUISetState(@SW_SHOW, $hGUI_Tab_Sub_D_11) EndSwitch EndSwitch ; Sub_D GUI Case $hGUI_Tab_Sub_D_11 _GUICtrlTab_SetCurSel($cTab_Sub_D, 2) ;Pre selection of the tab 3 Switch $aMsg[0] Case $cTab_Sub_D_11 Switch GUICtrlRead($cTab_Sub_D_11) Case 0 GUISetState(@SW_HIDE, $hGUI_Tab_Sub_D_11) GUISetState(@SW_SHOW, $hGUI_Tab_Sub_D) EndSwitch EndSwitch EndSwitch WEndThe idea is the 1st tab_main, the A (first tabitem always top)the 2nd Tab2 - the 222, (3 tabitem always top)the 3th Tab3 - table elements (2 tabitem always top)the <----- tabitem, it the back buttonThanks for your time and help im learning
Moderators Melba23 Posted December 12, 2015 Moderators Posted December 12, 2015 Rfsvieira,That is a clear as mud.I understand the requirement to swap between the various tabs, but the problem still remains that the code will become horribly complex as there are so many combinations that the user can select. So I ask again:What is the final aim of this script?Why are there all these different options?Forget about the complex explanations - just explain in ordinary language what you are trying to do here.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
Moderators Melba23 Posted December 12, 2015 Moderators Posted December 12, 2015 Rfsvieira,I have a working script which keeps things as simple as possible. Each tab selection creates a new child GUI so that you do not have huge idle loops to check for every control - each child GUI is a self-contained function so that you can even reuse the same variables for the controls. The trick is to set a variable to hold the name of the required child function and then return to the main loop and run it using a dummy - that way you do not get caught up in deciding which one should be visible. Take a look and see what you think:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <TabConstants.au3> Global $hGUI_Child, $sChild_Func = "_Create_Child_Main" $hGUI = GUICreate("Test", 450, 600) Global $cButton_Main_1 = GUICtrlCreateButton("BACK TO GUI", 0, 580, 450, 20) Global $cDraw_Child = GUICtrlCreateDummy() GUISetState() ; Draw main tab _Create_Child_Main() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton_Main_1 ; Set function to call $sChild_Func = "_Create_Child_Main" ; Fire dummy GUICtrlSendToDummy($cDraw_Child) Case $cDraw_Child ; Delete current child GUIDelete($hGUI_Child) ; Draw the required new child Call($sChild_Func) EndSwitch WEnd Func _Create_Child_Main() ; Always use this Global variable for eth child GUI $hGUI_Child = GUICreate("", 450, 460, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) ; All other variables should be local Local $cTab_Child = GUICtrlCreateTab(0, 0, 450, 460) GUICtrlCreateTabItem("A") $cButton_Child_1 = GUICtrlCreateButton("AAAAAAA", 16, 254, 75, 25) GUICtrlCreateTabItem("B") $cButton_Child_2 = GUICtrlCreateButton("BBBBBBB", 16, 254, 75, 25) GUICtrlCreateTabItem("C") GUICtrlCreateTabItem("D") GUICtrlCreateTabItem("E") GUICtrlCreateTabItem("") GUISetState() While 1 Switch GUIGetMsg() ; Always have these first 2 cases so the main GUI controls are active Case $GUI_EVENT_CLOSE Exit Case $cButton_Main_1 ; Select child to create next $sChild_Func = "_Create_Child_Main" ; Fire the dummy GUICtrlSendToDummy($cDraw_Child) ; Return to the main loop ExitLoop ; Now add cases for the child tab Case $cTab_Child Switch GUICtrlRead($cTab_Child) Case 0 ; "A" Case 1 ; "B" Case 2 ; "C" Case 3 ; "D" ; Select child to create next $sChild_Func = "_Create_Child_Main_3" ; Fire the dummy GUICtrlSendToDummy($cDraw_Child) ; Return to the main loop ExitLoop Case 2 ; "22" ; Add cases for other tabs EndSwitch Case $cButton_Child_1 MsgBox($MB_SYSTEMMODAL, "Pressed", "Button AAAAAAA") Case $cButton_Child_2 MsgBox($MB_SYSTEMMODAL, "Pressed", "Button BBBBBBB") ; Add cases for other controls EndSwitch WEnd EndFunc Func _Create_Child_Main_3() $hGUI_Child = GUICreate("", 450, 460, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) Local $cTab_Child = GUICtrlCreateTab(0 , 0, 450, 460, $TCS_BUTTONS) GUICtrlCreateTabItem("<----") GUICtrlCreateTabItem("11") GUICtrlSetState(-1, $GUI_SHOW) GUICtrlCreateTabItem("22") Local $cButton_Child_1 = GUICtrlCreateButton("222222", 16, 254, 75, 25) GUICtrlCreateTabItem("33") GUICtrlCreateTabItem("44") GUICtrlCreateTabItem("55") GUICtrlCreateTabItem("66") GUICtrlCreateTabItem("") GUISetState() While 1 Switch GUIGetMsg() ; Same Global cases Case $GUI_EVENT_CLOSE Exit Case $cButton_Main_1 $sChild_Func = "_Create_Child_Main" GUICtrlSendToDummy($cDraw_Child) ExitLoop ; These cases are local to this function Case $cTab_Child Switch GUICtrlRead($cTab_Child) Case 0 ; "<----" ; Set required child GUI to draw next $sChild_Func = "_Create_Child_Main" ; Fire dummy GUICtrlSendToDummy($cDraw_Child) ; Return to main loop ExitLoop Case 1 ; "11" $sChild_Func = "_Create_Child_Main_3_11" GUICtrlSendToDummy($cDraw_Child) ExitLoop Case 2 ; "22" ; Add cases for other tabs EndSwitch Case $cButton_Child_1 MsgBox($MB_SYSTEMMODAL, "Pressed", "Button 2222222") ; Add cases for other controls EndSwitch WEnd EndFunc Func _Create_Child_Main_3_11() $hGUI_Child = GUICreate("", 450, 460, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) Local $cTab_Child = GUICtrlCreateTab(0 , 0, 450, 460, $TCS_BUTTONS) GUICtrlCreateTabItem("<----") GUICtrlCreateTabItem("H2O") $cButton_Child_1 = GUICtrlCreateButton("WATER C", 16, 254, 75, 25) GUICtrlCreateTabItem("CO2") GUICtrlCreateTabItem("H2") GUICtrlCreateTabItem("02") GUICtrlCreateTabItem("") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton_Main_1 $sChild_Func = "_Create_Child_Main" GUICtrlSendToDummy($cDraw_Child) ExitLoop Case $cTab_Child Switch GUICtrlRead($cTab_Child) Case 0 ; "<----" $sChild_Func = "_Create_Child_Main_3" GUICtrlSendToDummy($cDraw_Child) ExitLoop Case 1 ; "H2O" $sChild_Func = "_Create_Child_Main_3_11_H2O" GUICtrlSendToDummy($cDraw_Child) ExitLoop Case 2 ; "22" ; Add cases for other tabs EndSwitch Case $cButton_Child_1 MsgBox($MB_SYSTEMMODAL, "Pressed", "Button WATER C") ; Add cases for other controls EndSwitch WEnd EndFunc Func _Create_Child_Main_3_11_H2O() $hGUI_Child = GUICreate("", 450, 460, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) $cButton_Child_1 = GUICtrlCreateButton("Back", 10, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton_Main_1 $sChild_Func = "_Create_Child_Main" GUICtrlSendToDummy($cDraw_Child) ExitLoop Case $cButton_Child_1 $sChild_Func = "_Create_Child_Main_3_11" GUICtrlSendToDummy($cDraw_Child) ExitLoop EndSwitch WEnd EndFuncI hope you can see how you need to structure each of the functions so that you create a child GUI with the required controls for each one and then add the 2 Global cases to the idle loop in every case so that the main GUI remains active. Then for each case that requires a new selection, you set the name of the function in the $sChild_Func variable, fire the $cDraw_Child dummy and exit the function so that the next child GUI can be created by the dummy calling the required function in the main idle loop. I must admit to being quite pleased with this as a solution.Please 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
Rfsvieira Posted December 12, 2015 Author Posted December 12, 2015 Hello, thanks for your time and ideas, is a quite dificult four me pass it to english let m try:Isnt, but its like a store, i can make it all in the same gui and tab, tabitem 1 to 13 (0-12) but will be a big window X -size like 600 +++++ 1st tab_main, the A to D (first tabitem always top)Itm1 -- tip of stores you like to see (check boxs)Item2 and 3 -- tip of produts by best our priority you like --- 14 combobox, ithchone with 20 options .... item2 8 options -- item3 12 options difirent off the item2item 4 is the about: contacts and registration on the web site+++++ 2nd Tab2 - the 222, (3 tabitem always top)if store 1,2,3,4,5,....9 checked from tab_mainwill have tabitem = checkbox name -------- in every item from 1 to 9 if checket, then will have 5 combobox (ITEM2 OPTIONS) and 5 combobox(ITEM3 OPTIONS)with the selected options have already the code working ++++++ the 3th Tab3 - table elements (2 tabitem always top)I make it because the user friendly and to be a smaller window, is because the check box 1,2,3,4 is the same store but all independente, its like store 1 with sub store 2,3,4tab3 only is maker because the user friendlythe <----- tabitem, it the back buttonResuming i can have one window with 1 tab and 14 tabitem, is easy, but the only problem is that the window X -size will be to big if i want all tabitem showedThanks for your time and help im learning This is all in the same window but is to big seeexpandcollapse popup#include <GuiTab.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $ps1, $ps2, $ps3 $hGUI = GUICreate("Test", 592, 460) GUISetBkColor(0x000000) $Pic1 = GUICtrlCreatePic(@ScriptDir & "\img\App\barra.jpg", 0, 0, 592, 120) $hTab_1 = GUICtrlCreateTab(0, 120, 592, 340) $hTab_10 = GUICtrlCreateTabitem("A") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0xEAEAEA) $Button1 = GUICtrlCreateButton("INICIAR", 6, 397, 575, 20) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Button2 = GUICtrlCreateButton("PARAR", 6, 422, 287, 20) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Button3 = GUICtrlCreateButton("SAIR", 293, 422, 287, 20) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox1 = GUICtrlCreateCheckbox("111111", 16, 184, 97, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetState(-1, $GUI_DISABLE) $Checkbox2 = GUICtrlCreateCheckbox("222222", 16, 206, 97, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox3 = GUICtrlCreateCheckbox("3333333", 16, 229, 97, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox4 = GUICtrlCreateCheckbox("4444444", 16, 252, 97, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox5 = GUICtrlCreateCheckbox("5555555", 16, 274, 97, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox6 = GUICtrlCreateCheckbox("6666666", 16, 342, 97, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox7 = GUICtrlCreateCheckbox("7777777", 16, 364, 97, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox8 = GUICtrlCreateCheckbox("88888888", 16, 296, 97, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox9 = GUICtrlCreateCheckbox("99999999", 16, 319, 97, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUISwitch($hGUI) $hTab_11 = GUICtrlCreateTabitem("B") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0xEAEAEA) $Label2 = GUICtrlCreateLabel("STORE", 51, 163, 52, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Pic1 = GUICtrlCreatePic("", 15, 202, 25, 25) $Pic2 = GUICtrlCreatePic("", 15, 234, 25, 25) $Pic3 = GUICtrlCreatePic("", 15, 264, 25, 25) $Pic4 = GUICtrlCreatePic("", 15, 296, 25, 25) $Pic5 = GUICtrlCreatePic("", 15, 330, 25, 25) $Pic6 = GUICtrlCreatePic("", 15, 361, 25, 25) $Pic7 = GUICtrlCreatePic("", 15, 394, 25, 25) $Combo7 = GUICtrlCreateCombo("ST", 47, 398, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") jcorpo($combo7) $Combo6 = GUICtrlCreateCombo("ST", 47, 365, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") jcorpo($combo6) $Combo5 = GUICtrlCreateCombo("ST", 47, 334, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") jcorpo($combo5) $Combo4 = GUICtrlCreateCombo("ST", 47, 300, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") jcorpo($combo4) $Combo3 = GUICtrlCreateCombo("ST", 47, 268, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") jcorpo($combo3) $Combo2 = GUICtrlCreateCombo("ST", 47, 238, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") jcorpo($combo2) $Combo1 = GUICtrlCreateCombo("ST", 47, 206, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") jcorpo($combo1) $Checkbox10 = GUICtrlCreateCheckbox("LIKE", 344, 208, 97, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUISwitch($hGUI) $hTab_12 = GUICtrlCreateTabitem("C") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0xEAEAEA) $hTab_13 = GUICtrlCreateTabitem("1111111") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0x819A41) $Pic44 = GUICtrlCreatePic("", 47, 191, 25, 25) $Pic45 = GUICtrlCreatePic("", 119, 191, 25, 25) $Pic46 = GUICtrlCreatePic("", 190, 191, 25, 25) $Pic47 = GUICtrlCreatePic("", 261, 191, 25, 25) $Pic48 = GUICtrlCreatePic("", 333, 191, 25, 25) $Combo43 = GUICtrlCreateCombo("ST", 315, 218, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Combo44 = GUICtrlCreateCombo("ST", 243, 218, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Combo45 = GUICtrlCreateCombo("ST", 171, 218, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Combo46 = GUICtrlCreateCombo("ST", 99, 218, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Combo47 = GUICtrlCreateCombo("ST", 27, 218, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label7 = GUICtrlCreateLabel("BEST OF ALL", 168, 152, 70, 23) GUICtrlSetFont(-1, 12, 800, 0, "Arial") $Pic49 = GUICtrlCreatePic("", 45, 307, 25, 25) $Combo48 = GUICtrlCreateCombo("PRDT", 21, 335, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Pic50 = GUICtrlCreatePic("", 117, 307, 25, 25) $Combo49 = GUICtrlCreateCombo("PROD", 94, 335, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Pic51 = GUICtrlCreatePic("", 189, 307, 25, 25) $Combo50 = GUICtrlCreateCombo("PROD", 166, 335, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Pic52 = GUICtrlCreatePic("", 261, 307, 25, 25) $Combo51 = GUICtrlCreateCombo("PROD", 239, 335, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Pic53 = GUICtrlCreatePic("", 333, 307, 25, 25) $Combo52 = GUICtrlCreateCombo("PROD", 312, 335, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label8 = GUICtrlCreateLabel("BEST PRODUTS", 162, 266, 100, 23) GUICtrlSetFont(-1, 12, 800, 0, "Arial") GUISwitch($hGUI) $hTab_14 = GUICtrlCreateTabitem("222222") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0x819A41) $hTab_15 = GUICtrlCreateTabitem("333333") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0x819A41) $hTab_16 = GUICtrlCreateTabitem("444444") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0x819A41) $hTab_17 = GUICtrlCreateTabitem("555555") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0xC8E3F1) $hTab_18 = GUICtrlCreateTabitem("6666666") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0xF4CD8A) $hTab_19 = GUICtrlCreateTabitem("7777777") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0xC94040) $hTab_20 = GUICtrlCreateTabitem("8888888") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0xD0B18E) $hTab_21 = GUICtrlCreateTabitem("9999999") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0x6FE3CD) $hTab_22 = GUICtrlCreateTabitem("D:") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0xF2F2F2) GUICtrlCreateTabitem ("") ; end tabitem definition GUISetState() While 1 Switch GUIGetMsg() Case $combo1 img1($combo1, $Pic1, 15, 202) case $combo2 img1($combo2, $pic2, 15, 234) Case $combo3 img1($combo3, $Pic3, 15, 264) case $combo4 img1($combo4, $pic4, 15, 296) case $combo5 img1($combo5, $pic5, 15, 330) Case $combo6 img1($combo6, $Pic6, 15, 361) case $combo7 img1($combo7, $pic7, 15, 394) Case $Button3 _exit() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd $dir =("FULL\") Func img1($var, $imp, $x1, $y1) ;GUISwitch($hGUI, $cTab_2) $Read = GUICtrlRead($var) If $Read = "CHOCOLATE" Then $imp = GUICtrlCreatePic($dir & "CHO.bmp", $x1, $y1, 25, 25) EndIf If $Read = "PANTIES" Then $imp = GUICtrlCreatePic($dir & "PAN.bmp", $x1, $y1, 25, 25) EndIf If $Read = "BOXERS" Then $imp = GUICtrlCreatePic($dir & "BOX.bmp", $x1, $y1, 25, 25) EndIf If $Read = "MENS" Then $imp = GUICtrlCreatePic($dir & "MNS.bmp", $x1, $y1, 25, 25) EndIf ;ETC......... If $Read = "" Then $imp = GUICtrlCreatePic($dir & "", $x1, $y1, 25, 25) Else $imp = GUICtrlCreatePic($dir & "nivel.bmp", $x1, $y1, 25, 25) EndIf EndFunc func _exit() Exit EndFunc Func jcorpo($varcomb); FUNCION FOR ITEM B , WITH SOME NAME OOUTHER FOR ITEM C WITH OTHER OPTIONS GUICtrlSetData($varcomb, "CHOCOLATES|PANTIES|BOXERS|MENS|WOMENS|SWORDS|GAMES|CARS|MOTOS|WATER|SOCCER|STRIPPERS") EndFunc Func _GUICtrlTab_SetBkColor($hWnd, $hSysTab32, $sBkColor) Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32) Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1) GUICtrlCreateLabel("", $aTabPos[0]+2, $aTabPos[1]+$aTab_Rect[3]+4, $aTabPos[2]-6, $aTabPos[3]-$aTab_Rect[3]-7) GUICtrlSetBkColor(-1, $sBkColor) GUICtrlSetState(-1, $GUI_DISABLE) EndFuncThanks
Moderators Melba23 Posted December 12, 2015 Moderators Posted December 12, 2015 Rfsvieira,the only problem is that the window X -size will be to big if i want all tabitem showedNot so - just use the $TCS_MULTILINE style like this:expandcollapse popup#include <GuiTab.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $ps1, $ps2, $ps3 $hGUI = GUICreate("Test", 592, 460) GUISetBkColor(0x000000) $Button1 = GUICtrlCreateButton("INICIAR", 6, 397, 575, 20) $Button2 = GUICtrlCreateButton("PARAR", 6, 422, 287, 20) $Button3 = GUICtrlCreateButton("SAIR", 293, 422, 287, 20) $hTab_1 = GUICtrlCreateTab(0, 120, 592, 340, $TCS_MULTILINE) ; <<<<<<<<<<<<<<<<<<<<<<<<<< $hTab_10 = GUICtrlCreateTabitem("A") $Checkbox1 = GUICtrlCreateCheckbox("111111", 16, 184, 97, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetState(-1, $GUI_DISABLE) $Checkbox2 = GUICtrlCreateCheckbox("222222", 16, 206, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("3333333", 16, 229, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("4444444", 16, 252, 97, 17) $Checkbox5 = GUICtrlCreateCheckbox("5555555", 16, 274, 97, 17) $Checkbox6 = GUICtrlCreateCheckbox("6666666", 16, 342, 97, 17) $Checkbox7 = GUICtrlCreateCheckbox("7777777", 16, 364, 97, 17) $Checkbox8 = GUICtrlCreateCheckbox("88888888", 16, 296, 97, 17) $Checkbox9 = GUICtrlCreateCheckbox("99999999", 16, 319, 97, 17) $hTab_11 = GUICtrlCreateTabitem("B") $Label2 = GUICtrlCreateLabel("STORE", 51, 163, 52, 24) $Combo7 = GUICtrlCreateCombo("ST", 47, 398, 65, 25) jcorpo($combo7) $Combo6 = GUICtrlCreateCombo("ST", 47, 365, 65, 25) jcorpo($combo6) $Combo5 = GUICtrlCreateCombo("ST", 47, 334, 65, 25) jcorpo($combo5) $Combo4 = GUICtrlCreateCombo("ST", 47, 300, 65, 25) jcorpo($combo4) $Combo3 = GUICtrlCreateCombo("ST", 47, 268, 65, 25) jcorpo($combo3) $Combo2 = GUICtrlCreateCombo("ST", 47, 238, 65, 25) jcorpo($combo2) $Combo1 = GUICtrlCreateCombo("ST", 47, 206, 65, 25) jcorpo($combo1) $Checkbox10 = GUICtrlCreateCheckbox("LIKE", 344, 208, 97, 17) $hTab_12 = GUICtrlCreateTabitem("C") $hTab_13 = GUICtrlCreateTabitem("1111111") $Combo43 = GUICtrlCreateCombo("ST", 315, 218, 65, 25) $Combo44 = GUICtrlCreateCombo("ST", 243, 218, 65, 25) $Combo45 = GUICtrlCreateCombo("ST", 171, 218, 65, 25) $Combo46 = GUICtrlCreateCombo("ST", 99, 218, 65, 25) $Combo47 = GUICtrlCreateCombo("ST", 27, 218, 65, 25) $Label7 = GUICtrlCreateLabel("BEST OF ALL", 168, 152, 70, 23) $Combo48 = GUICtrlCreateCombo("PRDT", 21, 335, 65, 25) $Combo49 = GUICtrlCreateCombo("PROD", 94, 335, 65, 25) $Combo50 = GUICtrlCreateCombo("PROD", 166, 335, 65, 25) $Combo51 = GUICtrlCreateCombo("PROD", 239, 335, 65, 25) $Combo52 = GUICtrlCreateCombo("PROD", 312, 335, 65, 25) $Label8 = GUICtrlCreateLabel("BEST PRODUTS", 162, 266, 100, 23) $hTab_14 = GUICtrlCreateTabitem("222222") $hTab_15 = GUICtrlCreateTabitem("333333") $hTab_16 = GUICtrlCreateTabitem("444444") $hTab_17 = GUICtrlCreateTabitem("555555") $hTab_18 = GUICtrlCreateTabitem("6666666") $hTab_19 = GUICtrlCreateTabitem("7777777") $hTab_20 = GUICtrlCreateTabitem("8888888") $hTab_21 = GUICtrlCreateTabitem("9999999") $hTab_22 = GUICtrlCreateTabitem("D:") GUICtrlCreateTabitem ("") ; end tabitem definition GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Button3 Exit EndSwitch WEnd Func jcorpo($varcomb); FUNCION FOR ITEM B , WITH SOME NAME OOUTHER FOR ITEM C WITH OTHER OPTIONS GUICtrlSetData($varcomb, "CHOCOLATES|PANTIES|BOXERS|MENS|WOMENS|SWORDS|GAMES|CARS|MOTOS|WATER|SOCCER|STRIPPERS") EndFuncYou will have to reposition some of the labels as they overlap with the lower tab row, but I hope the effect is clear enough.M23P.S. Fascinating selection of items in the combos, by the way! 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
Rfsvieira Posted December 14, 2015 Author Posted December 14, 2015 Só simple ;-) thanks, humano mind some times comolicate the easy thinks ;-) Another question, if i want that the tab apear depending of the checkboxs, i havê to make onde GUI for each option, exempleIf first 4 box a GUI with that four tabsIf first 4 and 8, a gui with it??Check 1,2,3,4, is inside some store, the options inside the 1,5,6,7,8,9, are igual, the 2,3,4, doesnt havê onde group of options becaus its in the 1st tabitem...I havê to make a GUI for every possible choises???Thaks for your help, hope not trying to do spaghetti :-P
Moderators Melba23 Posted December 14, 2015 Moderators Posted December 14, 2015 (edited) Rfsvieira,You do like complicating things!How about this - only the first 2 child GUIs are coded, but you should be able to see the idea:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> Global $aCheck[9], $aButton[9], $hGUI_Child = 9999 ; Note place holder value Global $sChild_Check, $iCurrChild $hGUI = GUICreate("Test", 500, 500) For $i = 1 To 8 $aCheck[$i] = GUICtrlCreateCheckbox(" " & $i, (50 * $i) - 40, 10, 50, 20) $aButton[$i] = 9999 ; Set place holder values for all buttons Next GUISetState() While 1 $iMsg = GUIGetMsg() ; Check main GUI controls Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case Else For $i = 1 To 8 If $iMsg = $aCheck[$i] Then ; Redraw required buttons _Redraw_Buttons() ExitLoop EndIf If $iMsg = $aButton[$i] Then ; Delete current child GUI GUIDelete($hGUI_Child) ; Unset button and store new selection GUICtrlSetState($aButton[$iCurrChild], $GUI_UNCHECKED) $iCurrChild = $i $sChild_Check = "_ChildGUI_" & $i ; Create child GUI Call($sChild_Check) ExitLoop EndIf Next EndSwitch ; Check child controls If $sChild_Check Then Call($sChild_Check, $iMsg) EndIf WEnd Func _Redraw_Buttons() ; Force creation in main GUI GUISwitch($hGUI) ; delete current buttons For $i = 1 To 8 GUICtrlDelete($aButton[$i]) Next ; Create new buttons $iX = 10 For $i = 1 To 8 If GUICtrlRead($aCheck[$i]) = $GUI_CHECKED Then $aButton[$i] = GUICtrlCreateCheckbox($i, $iX, 50, 40, 20, $BS_PUSHLIKE) $iX += 50 ; Force press of current selection If $i = $iCurrChild Then GUICtrlSetState($aButton[$i], $GUI_CHECKED) EndIf Else ; Reset placeholder value $aButton[$i] = 9999 EndIf Next EndFunc Func _ChildGUI_1() ; Controls need to be declared as Local Static so they are retained between function calls Local Static $cButton = 9999 ; Note initial place holder value ; This section runs to create the child intially If Not WinExists($hGUI_Child) Then ; Always use this Global variable for the child GUI $hGUI_Child = GUICreate("", 450, 300, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xCCFFCC) ; All other variables should be declared local static at function entry $cButton = GUICtrlCreateButton("Child 1", 10, 10, 80, 30) GUISetState() ; This section runs once the child is created Else Switch $iMsg Case $cButton MsgBox($MB_SYSTEMMODAL, "GUI 1", "Button pressed") EndSwitch EndIf EndFunc Func _ChildGUI_2() Local Static $cButton = 9999 If Not WinExists($hGUI_Child) Then ; Always use this Global variable for the child GUI $hGUI_Child = GUICreate("", 450, 300, 0, 120, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xFFCCCC) $cButton = GUICtrlCreateButton("Child 2", 10, 10, 80, 30) GUISetState() Else Switch $iMsg Case $cButton MsgBox($MB_SYSTEMMODAL, "GUI 2", "Button pressed") EndSwitch EndIf EndFuncAs you can see, each child function has 2 parts: the first to create the child GUI, the second to check for events. I hope my comments are clear enough for the script to be understood, please ask if not.M23Edit: Another version using a standard tab control where all the child GUIS are created first and then shown/hidden as required:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <GuiTab.au3> Global $aCheck[9], $aTab[9], $cTab = 9999 ; Note place holder value Global $sChild_Check, $iCurrChild = 1, $aChild[9] $hGUI = GUICreate("Test", 500, 500) For $i = 1 To 8 $aCheck[$i] = GUICtrlCreateCheckbox(" " & $i, (50 * $i) - 40, 10, 50, 20) $aChild[$i] = 9999 ; Set place holder values Next GUICtrlSetState($aCheck[1], $GUI_CHECKED) ; Create tab with 1 item $cTab = GUICtrlCreateTab(10, 50, 500, 400) GUICtrlCreateTabItem(1) GUICtrlCreateTabItem("") GUISetState() ; Create and hide child GUIs For $i = 1 To 2 ; Should be 8 of them $aChild[$i] = Call("_ChildGUI_" & $i) Next ; Show first child to match tab GUISetState(@SW_SHOW, $aChild[1]) While 1 $iMsg = GUIGetMsg() ; Check main GUI controls Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $cTab GUISetState(@SW_HIDE, $aChild[$iCurrChild]) $iTabIndex = GUICtrlRead($cTab) $iCurrChild = $aTab[$iTabIndex] GUISetState(@SW_SHOW, $aChild[$iCurrChild]) $sChild_Check = "_ChildGUI_" & $iCurrChild Case Else For $i = 1 To 8 If $iMsg = $aCheck[$i] Then ; Redraw tab _Redraw_Tab() ExitLoop EndIf Next EndSwitch ; Check child controls If $sChild_Check Then Call($sChild_Check, $iMsg) EndIf WEnd Func _Redraw_Tab() ; Check at least 1 checkbox checked Local $bChecked = False For $i = 1 To 8 If GUICtrlRead($aCheck[$i]) = $GUI_CHECKED Then $bChecked = True ExitLoop EndIf Next If $bChecked = False Then ; Get current tab value $iIndex = _GUICtrlTab_GetItemText($cTab, 0) ; Reset checkbox GUICtrlSetState($aCheck[$iIndex], $GUI_CHECKED) Return EndIf ; Delete current tab and hide child GUI GUICtrlDelete($cTab) GUISetState(@SW_HIDE, $aChild[$iCurrChild]) ; Force creation in main GUI GUISwitch($hGUI) ; Create new tab and match tabs to child GUIs Local $iIndex = 0 $cTab = GUICtrlCreateTab(10, 50, 500, 400) For $i = 1 To 8 If GUICtrlRead($aCheck[$i]) = $GUI_CHECKED Then ; Create tab item $cTabItem = GUICtrlCreateTabItem($i) ; Link to child GUI $aTab[$iIndex] = $i $iIndex += 1 EndIf Next GUICtrlCreateTabItem("") ; Set new current taba nd show correct GUI $iCurrChild = $aTab[GUICtrlRead($cTab)] GUISetState(@SW_SHOW, $aChild[$iCurrChild]) EndFunc Func _ChildGUI_1() ; Controls need to be declared as Local Static so they are retained between function calls Local Static $hGUI_Child = 9999 Local Static $cButton = 9999 ; Note initial place holder value ; This section runs to create the child intially If $hGUI_Child = 9999 Then ; Always use this Global variable for the child GUI $hGUI_Child = GUICreate("", 450, 350, 20, 90, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xCCFFCC) ; All other variables should be declared local static at function entry $cButton = GUICtrlCreateButton("Child 1", 10, 10, 80, 30) GUISetState(@SW_HIDE) Return $hGUI_Child ; This section runs once the child is created Else Switch $iMsg Case $cButton MsgBox($MB_SYSTEMMODAL, "GUI 1", "Button pressed") EndSwitch EndIf EndFunc Func _ChildGUI_2() ; Controls need to be declared as Local Static so they are retained between function calls Local Static $hGUI_Child = 9999 Local Static $cButton = 9999 ; Note initial place holder value ; This section runs to create the child intially If $hGUI_Child = 9999 Then ; Always use this Global variable for the child GUI $hGUI_Child = GUICreate("", 450, 350, 20, 90, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xFFCCCC) ; All other variables should be declared local static at function entry $cButton = GUICtrlCreateButton("Child 2", 10, 10, 80, 30) GUISetState(@SW_HIDE) Return $hGUI_Child ; This section runs once the child is created Else Switch $iMsg Case $cButton MsgBox($MB_SYSTEMMODAL, "GUI 2", "Button pressed") EndSwitch EndIf EndFunc Edited December 14, 2015 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
Rfsvieira Posted December 14, 2015 Author Posted December 14, 2015 Very very thanks for your time, yes im a litle complicat, but is with that i learn more and more I prefere the secound option, wll try change the name of the checkboxs because the user doesnt understand 1,2,3,.... but now i have all idea and can chose one, very thanks for your time, i´m trying read the wiki online to learn more, i have read na PDF manual but its basicly has lot information but not enoughtThanks again, now i can practise, off course i will have alote of questions in future, like the funcions by timing and priority, if ends at some time, but will try search and make it work, if not i askThanks
Moderators Melba23 Posted December 14, 2015 Moderators Posted December 14, 2015 Rfsvieira,Glad I could help. if not i askPlease do.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
antonioj84 Posted February 20, 2017 Posted February 20, 2017 (edited) Hey Guys , this is Harry I am using melba23 code ,however I want to be able to to access control like "create IP Data" for each separate menu under their individual tab. i realise the best approach is to create a Gui, which i am not able to figure out. Right now i have the gui under each separate function Guimenu0 - Guimenu2. can someone give me some tips how to do that. expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiTab.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Excel.au3> #include <File.au3> #include <Array.au3> #include <Date.au3> #include <String.au3> #include <GuiListView.au3> #include <GuiComboBox.au3> #include <ComboConstants.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <Misc.au3> #include <ado_CONSTANTS.AU3> #include <ColorConstants.au3> #include <ColorConstants.au3> #include <GDIPlus.au3> ;#include "MPDF_UDF.au3" ;#include <ScreenCapture.au3> ;#include "_Excel_BookOpenEX.au3" ;#include <Process.au3> ; Tab colours Global $aTabColours[3] = [0xFFC0C0, 0xC0C0FF, 0xC0C0C0] Global $iTab_Index ; Create GUI ;Global $hGUI = GUICreate ("Test", 400,300) Global $hGUI = GUICreate ("IP CALCULATOR",694, 1019, 627, 0); 400,300) ;GUISetBkColor (0) ; Create label to cover tab "tab" Global $hColourTab = GUICtrlCreateLabel("", 0, 0, 1, 1, BitOR($SS_NOTIFY, $SS_CENTER, $SS_SUNKEN)) ; Create tab Global $hTab = GUICtrlCreateTab(7, 5,682, 1019) Global $hTab_Handle = GUICtrlGetHandle($hTab) ; Create tab items and colour them For $i = 0 To 2 if $i = 0 Then $b = "Store CASA" Else $b="" EndIf if $i = 1 Then $c = "Store Regular" Else $c="" EndIf if $i = 2 Then $d = "Store Training" Else $d="" EndIf GUICtrlCreateTabItem ($i&" - "&$b &$c&$d ) _GUICtrlTab_SetBkColor($hGUI, $hTab, $aTabColours[$i]) GUICtrlCreateTabItem ("") Next _GUICtrlTab_SetCurSel($hTab_Handle,0) _GUICtrlTab_SetCurFocus($hTab_Handle,0) ;TabEvent() ; This is the current active tab $iLastTab = 0 GUImenu0() GUISetState () Func GUImenu0() #Region ### START Koda GUI section ### Form=C:\Users\Antonio\Desktop\autoit excel form2\ipcalculatorGUI.kxf ;$hGUI = GUICreate("Test", 666, 1003, 662, 52) ;GUICtrlCreateLabel("", 0, 0, 1, 1, BitOR($SS_CENTER,$SS_SUNKEN)) ;$hTab = GUICtrlCreateTab(5, 5, 682, 1019) ;GUICtrlCreateTabItem("Tab item - i") ;GUICtrlCreateLabel("", 9, 30, 4, 4) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label3 = GUICtrlCreateLabel("STORENUM", 36, 53, 66, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xFFC0C0) $Input3 = GUICtrlCreateInput("", 108, 51, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Button6 = GUICtrlCreateButton("Create Screen Capture", 84, 349, 120, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $listview = GUICtrlCreateListView("| UCS Subnet/ 28||", 252, 53, 361, 625, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $setting = GUICtrlCreateButton("Setting", 12, 957, 91, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $exit = GUICtrlCreateButton("Exit", 92, 437, 91, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label4 = GUICtrlCreateLabel("Register", 48, 83, 54, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xFFC0C0) $Input4 = GUICtrlCreateInput("4", 108, 81, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $Button4 = GUICtrlCreateButton("Create IP Data", 89, 301, 107, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetTip(-1, "list ip information for svr lan , black lan, mobileS POS and registers") $Input5 = GUICtrlCreateInput("2", 108, 203, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label6 = GUICtrlCreateLabel("Printer front/back", 14, 205, 88, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xFFC0C0) $Label2 = GUICtrlCreateLabel("Tablet", 50, 114, 52, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xFFC0C0) $Input1 = GUICtrlCreateInput("", 108, 112, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Input2 = GUICtrlCreateInput("2", 108, 142, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Input6 = GUICtrlCreateInput("2", 108, 173, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label1 = GUICtrlCreateLabel("Receipt Printer", 26, 144, 76, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xFFC0C0) $Label7 = GUICtrlCreateLabel("Tablet Printer", 26, 175, 76, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xFFC0C0) GUICtrlCreateTabItem("") ;GUICtrlCreateTabItem("") ;GUICtrlSetState(-1, $hGUI_HIDE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### EndFunc Func GUImenu1() #Region ### START Koda GUI section ### Form=C:\Users\Antonio\Desktop\autoit excel form2\ipcalculatorGUI.kxf ;$hGUI = GUICreate("Test", 666, 1003, 662, 52) ;GUICtrlCreateLabel("", 0, 0, 1, 1, BitOR($SS_CENTER,$SS_SUNKEN)) ;$hTab = GUICtrlCreateTab(5, 5, 682, 1019) ;GUICtrlCreateTabItem("Tab item - i") ;GUICtrlCreateLabel("", 9, 30, 4, 4) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label3 = GUICtrlCreateLabel("STORENUM", 36, 53, 66, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xC0C0FF) $Input3 = GUICtrlCreateInput("", 108, 51, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Button6 = GUICtrlCreateButton("Create Screen Capture", 84, 349, 120, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $listview = GUICtrlCreateListView("| UCS Subnet/ 28||", 252, 53, 361, 625, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $setting = GUICtrlCreateButton("Setting", 12, 957, 91, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $exit = GUICtrlCreateButton("Exit", 92, 437, 91, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label4 = GUICtrlCreateLabel("Register", 48, 83, 54, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1,0xC0C0FF) $Input4 = GUICtrlCreateInput("4", 108, 81, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $Button4 = GUICtrlCreateButton("Create IP Data", 89, 301, 107, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetTip(-1, "list ip information for svr lan , black lan, mobileS POS and registers") $Input5 = GUICtrlCreateInput("2", 108, 203, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label6 = GUICtrlCreateLabel("Printer front/back", 14, 205, 88, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xC0C0FF) ;$Label2 = GUICtrlCreateLabel("Tablet", 50, 114, 52, 17) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;GUICtrlSetBkColor(-1,0xC0C0FF) ;$Input1 = GUICtrlCreateInput("", 108, 112, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;$Input2 = GUICtrlCreateInput("2", 108, 142, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;$Input6 = GUICtrlCreateInput("2", 108, 173, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;$Label1 = GUICtrlCreateLabel("Receipt Printer", 26, 144, 76, 17) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;GUICtrlSetBkColor(-1, 0xC0C0FF) ;$Label7 = GUICtrlCreateLabel("Tablet Printer", 26, 175, 76, 25) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;GUICtrlSetBkColor(-1, 0xC0C0FF) GUICtrlCreateTabItem("") ;GUICtrlCreateTabItem("") ;GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### EndFunc Func GUImenu2() #Region ### START Koda GUI section ### Form=C:\Users\Antonio\Desktop\autoit excel form2\ipcalculatorGUI.kxf ;$hGUI = GUICreate("Test", 666, 1003, 662, 52) ;GUICtrlCreateLabel("", 0, 0, 1, 1, BitOR($SS_CENTER,$SS_SUNKEN)) ;$hTab = GUICtrlCreateTab(5, 5, 682, 1019) ;GUICtrlCreateTabItem("Tab item - i") ;GUICtrlCreateLabel("", 9, 30, 4, 4) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label3 = GUICtrlCreateLabel("STORENUM", 36, 53, 66, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xC0C0C0) $Input3 = GUICtrlCreateInput("", 108, 51, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Button6 = GUICtrlCreateButton("Create Screen Capture", 84, 349, 120, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $listview = GUICtrlCreateListView("| UCS Subnet/ 28||", 252, 53, 361, 625, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $setting = GUICtrlCreateButton("Setting", 12, 957, 91, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $exit = GUICtrlCreateButton("Exit", 92, 437, 91, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label4 = GUICtrlCreateLabel("Register", 48, 83, 54, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xC0C0C0) $Input4 = GUICtrlCreateInput("4", 108, 81, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $Button4 = GUICtrlCreateButton("Create IP Data", 89, 301, 107, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetTip(-1, "list ip information for svr lan , black lan, mobileS POS and registers") $Input5 = GUICtrlCreateInput("2", 108, 203, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label6 = GUICtrlCreateLabel("Printer front/back", 14, 205, 88, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xC0C0C0) $Label2 = GUICtrlCreateLabel("Tablet", 50, 114, 52, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xC0C0C0) $Input1 = GUICtrlCreateInput("", 108, 112, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Input2 = GUICtrlCreateInput("2", 108, 142, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Input6 = GUICtrlCreateInput("2", 108, 173, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label1 = GUICtrlCreateLabel("Receipt Printer", 26, 144, 76, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xC0C0C0) $Label7 = GUICtrlCreateLabel("Tablet Printer", 26, 175, 76, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xC0C0C0) GUICtrlCreateTabItem("") ;GUICtrlCreateTabItem("") ;GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### EndFunc While 1 Switch GUIGetMsg () Case $GUI_EVENT_CLOSE Exit Case $hTab EndSwitch ;WEnd ; Check which Tab is active $iCurrTab = _GUICtrlTab_GetCurFocus($hTab) ; If the Tab has changed If $iCurrTab <> $iLastTab Then ; Store the value for future comparisons $iLastTab = $iCurrTab ; Show/Hide controls as required Switch $iCurrTab Case 0 GUImenu0() ; GUICtrlSetState($hBuiltIn_Buttons[1], $GUI_HIDE) ; GUICtrlSetState($hBuiltIn_Buttons[2], $GUI_HIDE) ; GUICtrlSetState($hBuiltIn_Buttons[0], $GUI_SHOW) ; ControlHide($hGUI, "", $hUDF_Buttons[1]) ; ControlHide($hGUI, "", $hUDF_Buttons[2]) ; ControlShow($hGUI, "", $hUDF_Buttons[0]) case $Button4 MsgBox(0,"","hello0") Case 1 GUImenu1() ;GUICtrlSetState($hBuiltIn_Buttons[0], $GUI_HIDE) ;GUICtrlSetState($hBuiltIn_Buttons[2], $GUI_HIDE) ;GUICtrlSetState($hBuiltIn_Buttons[1], $GUI_SHOW) ;ControlHide($hGUI, "", $hUDF_Buttons[0]) ;ControlHide($hGUI, "", $hUDF_Buttons[2]) ;ControlShow($hGUI, "", $hUDF_Buttons[1]) ; case $Button4 ;MsgBox(0,"","hello1") Case 2 GUImenu2() ;GUICtrlSetState($hBuiltIn_Buttons[0], $GUI_HIDE) ;GUICtrlSetState($hBuiltIn_Buttons[1], $GUI_HIDE) ; GUICtrlSetState($hBuiltIn_Buttons[2], $GUI_SHOW) ;ControlHide($hGUI, "", $hUDF_Buttons[0]) ; ControlHide($hGUI, "", $hUDF_Buttons[1]) ; ControlShow($hGUI, "", $hUDF_Buttons[2]) ;Case $Button4 MsgBox(0,"","hello2") EndSwitch EndIf WEnd Func TabEvent() ; Set values Local $iTab_X = 5, $iTab_Y = 5, $iTab_Margin = 1 ; Get index of current tab Local $iTab_Index = GUICtrlRead($hTab) ;ConsoleWrite("index"& $iTab_Index) ; Get coordinates of TabItem Local $aTab_Coord = _GUICtrlTab_GetItemRect($hTab_Handle, $iTab_Index) ; Get text of TabItem Local $sTab_Text = _GUICtrlTab_GetItemText($hTab_Handle, $iTab_Index) ; Place label GUICtrlSetPos($hColourTab, $iTab_X + $aTab_Coord[0] + $iTab_Margin, $iTab_Y + $aTab_Coord[1] + $iTab_Margin, $aTab_Coord[2] - $aTab_Coord[0] - ($iTab_Margin * 2), $aTab_Coord[3] - $aTab_Coord[1] - ($iTab_Margin * 2) + 5) ; Set text GUICtrlSetData($hColourTab, $sTab_Text) ; Set colour GUICtrlsetBkColor ($hColourTab,$aTabColours[$iTab_Index] ) ; Set focus _GUICtrlTab_SetCurFocus($hTab_Handle,$iTab_Index) ;GUISwitch($hGUIParent1, $iTab_Index) ;Return($iTab_Index) EndFunc Func _GUICtrlTab_SetBkColor($hWnd, $hSysTab32, $sBkColor) ; Get tab position Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32) ; Get size of user area Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1) ; Create label GUICtrlCreateLabel("", $aTabPos[0] + 2, $aTabPos[1] + $aTab_Rect[3] + 4, $aTabPos[2] - 6, $aTabPos[3] - $aTab_Rect[3] - 7) ; Colour label GUICtrlSetBkColor(-1, $sBkColor) ; Disable label GUICtrlSetState(-1, $GUI_DISABLE) EndFunc ;==>_GUICtrlTab_SetBkColor Edited February 20, 2017 by antonioj84 correction
Moderators Melba23 Posted February 20, 2017 Moderators Posted February 20, 2017 antonioj84, Your explanation above is clear as mud and looking at the code does not help much either. Which controls should be in separate tabs and which not? 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
antonioj84 Posted February 20, 2017 Posted February 20, 2017 (edited) hi Melba23, bottom line i want to be able to fire this: case $buttton4 which is the "create IP data" if you run the code you will have a better idea thanks Switch $iCurrTab Case 0 GUImenu0() ; GUICtrlSetState($hBuiltIn_Buttons[1], $GUI_HIDE) ; GUICtrlSetState($hBuiltIn_Buttons[2], $GUI_HIDE) ; GUICtrlSetState($hBuiltIn_Buttons[0], $GUI_SHOW) ; ControlHide($hGUI, "", $hUDF_Buttons[1]) ; ControlHide($hGUI, "", $hUDF_Buttons[2]) ; ControlShow($hGUI, "", $hUDF_Buttons[0]) case $Button4 MsgBox(0,"","hello0") Edited February 20, 2017 by antonioj84 correction
Moderators Melba23 Posted February 20, 2017 Moderators Posted February 20, 2017 antonioj84, Then set $button4 as a Global variable at the top of the script. However, that code is a real mess - you are constantly creating and recreating controls with every tab change and never deleting any. Let me see if I can come up with something a little more elegant. M23 antonioj84 1 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
Moderators Melba23 Posted February 20, 2017 Moderators Posted February 20, 2017 antonioj84, Take a look at this script which I think does what you want: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTab.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <ListViewConstants.au3> ; Create arrays to hold the controls on each tab Global $aInput[7][3], $aButtons[7][3], $aListViews[3] ; Tab colours Global $aTabColours[3] = [0xFFC0C0, 0xC0C0FF, 0xC0C0C0] Global $aTabTitles[3] = ["Store CASA", "Store Regular", "Store Training"] Global $iTab_Index ; Create GUI Global $hGUI = GUICreate("IP CALCULATOR", 694, 1019, 627, 0) ; 400,300) ; Set teh font for eh whole GUI - then you do not have to do it for each control <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUISetFont(8, 400, 0, "Arial") ; Create label to cover tab "tab" Global $hColourTab = GUICtrlCreateLabel("", 0, 0, 1, 1, BitOR($SS_NOTIFY, $SS_CENTER, $SS_SUNKEN)) ; Create tab Global $cTab = GUICtrlCreateTab(7, 5, 682, 1019) ; Create tab items and colour them For $i = 0 To 2 GUICtrlCreateTabItem($i & " - " & $aTabTitles[$i]) If $i = 0 Then ; Set 0 as active tab GUICtrlSetState(-1, $GUI_SHOW) $iCurrTab = 0 EndIf _GUICtrlTab_SetBkColor($hGUI, $cTab, $aTabColours[$i]) ; Create controls on each tab Call("GUImenu" & $i) Next ; End tab defintion just the once GUICtrlCreateTabItem("") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cTab ; Get the current tab $iCurrTab = GUICtrlRead($cTab) ; Now we can use this value to access the relevant set of controls in the arrays Case $aButtons[1][$iCurrTab] MsgBox($MB_SYSTEMMODAL, "Pressed", "Setting Button on tab " & $iCurrTab) Case $aButtons[2][$iCurrTab] MsgBox($MB_SYSTEMMODAL, "Pressed", "Exit Button on tab " & $iCurrTab) Exit Case $aButtons[4][$iCurrTab] MsgBox($MB_SYSTEMMODAL, "Pressed", "Create IP Data Button on tab " & $iCurrTab) Case $aButtons[6][$iCurrTab] MsgBox($MB_SYSTEMMODAL, "Pressed", "Screen Capture Button on tab " & $iCurrTab) EndSwitch WEnd Func GUImenu0() ; The controls on each Tab are stored in the relevant section of the arrays GUICtrlCreateLabel("STORENUM", 36, 53, 66, 17) ; No need to store ControlID if you never use it <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $aInput[3][0] = GUICtrlCreateInput("", 108, 51, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $aButtons[6][0] = GUICtrlCreateButton("Create Screen Capture", 84, 349, 120, 33) $aListViews[0] = GUICtrlCreateListView("| UCS Subnet/ 28||", 252, 53, 361, 625, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50) $aButtons[1][0] = GUICtrlCreateButton("Setting", 12, 957, 91, 33) $aButtons[2][0] = GUICtrlCreateButton("Exit", 92, 437, 91, 33) GUICtrlCreateLabel("Register", 48, 83, 54, 17) $aInput[4][0] = GUICtrlCreateInput("4", 108, 81, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $aButtons[4][0] = GUICtrlCreateButton("Create IP Data", 89, 301, 107, 33) $aInput[5][0] = GUICtrlCreateInput("2", 108, 203, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) GUICtrlCreateLabel("Printer front/back", 14, 205, 88, 25) GUICtrlCreateLabel("Tablet", 50, 114, 52, 17) $aInput[1][0] = GUICtrlCreateInput("", 108, 112, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $aInput[2][0] = GUICtrlCreateInput("2", 108, 142, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $aInput[6][0] = GUICtrlCreateInput("2", 108, 173, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) GUICtrlCreateLabel("Receipt Printer", 26, 144, 76, 17) GUICtrlCreateLabel("Tablet Printer", 26, 175, 76, 25) EndFunc ;==>GUImenu0 Func GUImenu1() GUICtrlCreateLabel("STORENUM", 36, 53, 66, 17) $aInput[3][1] = GUICtrlCreateInput("", 108, 51, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $aButtons[6][1] = GUICtrlCreateButton("Create Screen Capture", 84, 349, 120, 33) $aListViews[1] = GUICtrlCreateListView("| UCS Subnet/ 28||", 252, 53, 361, 625, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50) $aButtons[1][1] = GUICtrlCreateButton("Setting", 12, 957, 91, 33) $aButtons[2][1] = GUICtrlCreateButton("Exit", 92, 437, 91, 33) GUICtrlCreateLabel("Register", 48, 83, 54, 17) $aInput[4][1] = GUICtrlCreateInput("4", 108, 81, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $aButtons[4][1] = GUICtrlCreateButton("Create IP Data", 89, 301, 107, 33) $aInput[5][1] = GUICtrlCreateInput("2", 108, 203, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) GUICtrlCreateLabel("Printer front/back", 14, 205, 88, 25) EndFunc ;==>GUImenu1 Func GUImenu2() GUICtrlCreateLabel("STORENUM", 36, 53, 66, 17) $aInput[3][2] = GUICtrlCreateInput("", 108, 51, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $aButtons[6][2] = GUICtrlCreateButton("Create Screen Capture", 84, 349, 120, 33) $aListViews[2] = GUICtrlCreateListView("| UCS Subnet/ 28||", 252, 53, 361, 625, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50) $aButtons[1][2] = GUICtrlCreateButton("Setting", 12, 957, 91, 33) $aButtons[2][2] = GUICtrlCreateButton("Exit", 92, 437, 91, 33) GUICtrlCreateLabel("Register", 48, 83, 54, 17) $aInput[4][2] = GUICtrlCreateInput("4", 108, 81, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $aButtons[4][2] = GUICtrlCreateButton("Create IP Data", 89, 301, 107, 33) $aInput[5][2] = GUICtrlCreateInput("2", 108, 203, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) GUICtrlCreateLabel("Printer front/back", 14, 205, 88, 25) GUICtrlCreateLabel("Tablet", 50, 114, 52, 17) $aInput[1][0] = GUICtrlCreateInput("", 108, 112, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $aInput[2][0] = GUICtrlCreateInput("2", 108, 142, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $aInput[6][0] = GUICtrlCreateInput("2", 108, 173, 57, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) GUICtrlCreateLabel("Receipt Printer", 26, 144, 76, 17) GUICtrlCreateLabel("Tablet Printer", 26, 175, 76, 25) EndFunc ;==>GUImenu2 Func _GUICtrlTab_SetBkColor($hWnd, $hSysTab32, $sBkColor) ; Get tab position Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32) ; Get size of user area Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1) ; Create label GUICtrlCreateLabel("", $aTabPos[0] + 2, $aTabPos[1] + $aTab_Rect[3] + 4, $aTabPos[2] - 6, $aTabPos[3] - $aTab_Rect[3] - 7) ; Colour label GUICtrlSetBkColor(-1, $sBkColor) ; Disable label GUICtrlSetState(-1, $GUI_DISABLE) EndFunc ;==>_GUICtrlTab_SetBkColor Now you only create the controls on each tab once and use the selected tab to get the correct set of controls actioned in the GUIGetMsg loop. I have also set the font globally just the once rather than individually for each control - plus a few other little tips. Please ask if you have any questions - or if anything I have done is unclear. M23 antonioj84 1 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
antonioj84 Posted February 20, 2017 Posted February 20, 2017 (edited) Hi Melba23, Thanks you so much it does exactly what I want. Nice coding Edited February 20, 2017 by antonioj84 ok
Moderators Melba23 Posted February 20, 2017 Moderators Posted February 20, 2017 antonioj84, Glad I could help. M23 antonioj84 1 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
antonioj84 Posted February 26, 2017 Posted February 26, 2017 (edited) Hi All, I have a question about the same GUI. I am trying to implement for each time the TAb Casa = 0 is selected to refresh the listview[0], Case $cTab ; Get the current tab $iCurrTab = GUICtrlRead($cTab) ;~If $iCurrTab = 0 Then SearchIP($iCurrTab) ; refresh the listview for casa tab if $iCurrTab=0 Then _GUICtrlListView_RedrawItems($aListViews[0], 0,20 ) ; REFRESH the view (does not work) however the GRID is not refreshed. The example in the help file was not totally helpful Edited February 26, 2017 by antonioj84 ok
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