Letraindusoir Posted July 19, 2020 Posted July 19, 2020 (edited) expandcollapse popup#include <GUIConstantsEx.au3> Example() Func Example() GUICreate("My GUI Tab") GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) GUICtrlCreateTab(10, 10, 380, 256) GUICtrlCreateTabItem("tab----0") 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") GUICtrlCreateButton("OK1", 80, 50, 50, 20) GUICtrlCreateTabItem("tab----2") GUICtrlSetState(-1, $GUI_SHOW) GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem("") Local $idButtonAdd= GUICtrlCreateButton("Add", 20, 296, 75,35) GUISetState(@SW_SHOW) Local $idMsg While 1 $idMsg = GUIGetMsg() If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop If $idMsg = $idButtonAdd Then Local $idDate_Tab2 = GUICtrlCreateMonthCal("2048/03/25", 20,175,160,35);want to create a MonthCal Control within TabItem 'tab----2' Local $idLabl_Tab1 = GUICtrlCreateEdit("Test", 35,120,240,30);want to create a Label Control within TabItem 'tab----1' Local $idLabl_Tab0 = GUICtrlCreateIcon("shell32.dll", 310,285, 225);want to create an Icon Control within TabItem 'tab----0' EndIf WEnd EndFunc As shown above, if want to dynamically add controls to the Tab-control's tabitem, how locate it separately? Thanks in advance! Edited July 19, 2020 by Letraindusoir
Dan_555 Posted July 19, 2020 Posted July 19, 2020 (edited) Use GUISwitch($hGui, $hTab0) to select a tab which will get the items, then add as many items to the tab, as needed, then use the GUICtrlCreateTabItem("") to stop adding items. expandcollapse popup#include <GUIConstantsEx.au3> Example() Func Example() Global $hTab, $hTabActive $hGui = GUICreate("My GUI Tab") GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $hTab = GUICtrlCreateTab(10, 10, 380, 256) $hTab0 = GUICtrlCreateTabItem("tab----0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) GUICtrlCreateButton("OK0", 20, 50, 50, 20) GUICtrlCreateInput("default", 80, 50, 70, 20) $hTab1 = GUICtrlCreateTabItem("tab----1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) GUICtrlCreateCombo("", 20, 50, 60, 120) GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo|guinness", "Jon") GUICtrlCreateButton("OK1", 80, 50, 50, 20) $hTab2 = GUICtrlCreateTabItem("tab----2") GUICtrlSetState(-1, $GUI_SHOW) GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem("") Local $idButtonAdd = GUICtrlCreateButton("Add", 20, 296, 75, 35) GUISetState(@SW_SHOW) Local $idMsg While 1 $idMsg = GUIGetMsg() If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop If $idMsg = $idButtonAdd Then ;$hTabActive = GUICtrlRead($hTab) GUISwitch($hGui, $hTab2) Local $idDate_Tab2 = GUICtrlCreateMonthCal("2048/03/25", 20, 175, 160, 35, -1, -1) ;want to create a MonthCal Control within TabItem 'tab----2' GUICtrlCreateTabItem("") GUISwitch($hGui, $hTab1) Local $idLabl_Tab1 = GUICtrlCreateEdit("Test", 35, 120, 240, 30) ;want to create a Label Control within TabItem 'tab----1' GUICtrlCreateTabItem("") GUISwitch($hGui, $hTab0) Local $idLabl_Tab0 = GUICtrlCreateIcon("shell32.dll", 310, 285, 225) ;want to create an Icon Control within TabItem 'tab----0' GUICtrlCreateTabItem("") EndIf WEnd EndFunc ;==>Example Edited July 19, 2020 by Dan_555 Letraindusoir 1 Some of my script sourcecode
Letraindusoir Posted July 19, 2020 Author Posted July 19, 2020 1 hour ago, Dan_555 said: Use GUISwitch($hGui, $hTab0) to select a tab which will get the items, then add as many items to the tab, as needed, then use the GUICtrlCreateTabItem("") to stop adding items. expandcollapse popup#include <GUIConstantsEx.au3> Example() Func Example() Global $hTab, $hTabActive $hGui = GUICreate("My GUI Tab") GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $hTab = GUICtrlCreateTab(10, 10, 380, 256) $hTab0 = GUICtrlCreateTabItem("tab----0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) GUICtrlCreateButton("OK0", 20, 50, 50, 20) GUICtrlCreateInput("default", 80, 50, 70, 20) $hTab1 = GUICtrlCreateTabItem("tab----1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) GUICtrlCreateCombo("", 20, 50, 60, 120) GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo|guinness", "Jon") GUICtrlCreateButton("OK1", 80, 50, 50, 20) $hTab2 = GUICtrlCreateTabItem("tab----2") GUICtrlSetState(-1, $GUI_SHOW) GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem("") Local $idButtonAdd = GUICtrlCreateButton("Add", 20, 296, 75, 35) GUISetState(@SW_SHOW) Local $idMsg While 1 $idMsg = GUIGetMsg() If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop If $idMsg = $idButtonAdd Then ;$hTabActive = GUICtrlRead($hTab) GUISwitch($hGui, $hTab2) Local $idDate_Tab2 = GUICtrlCreateMonthCal("2048/03/25", 20, 175, 160, 35, -1, -1) ;want to create a MonthCal Control within TabItem 'tab----2' GUICtrlCreateTabItem("") GUISwitch($hGui, $hTab1) Local $idLabl_Tab1 = GUICtrlCreateEdit("Test", 35, 120, 240, 30) ;want to create a Label Control within TabItem 'tab----1' GUICtrlCreateTabItem("") GUISwitch($hGui, $hTab0) Local $idLabl_Tab0 = GUICtrlCreateIcon("shell32.dll", 310, 285, 225) ;want to create an Icon Control within TabItem 'tab----0' GUICtrlCreateTabItem("") EndIf WEnd EndFunc ;==>Example Very much appreciated. it Works good,thanks for your help!
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