jaberwacky Posted August 13, 2016 Share Posted August 13, 2016 (edited) I'm trying to create a tab dynamically. Could I also add controls to to a tab item after the fact? Here is what I have so far demonstrating the problem which you'll see when ran. #include <GUIConstantsEx.au3> #include <GuiTab.au3> #include <WindowsConstants.au3> Global $hWnd = GUICreate("Tab Experiment", 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) Global $button_array[3] = [GUICtrlCreateButton("Click To Create A Tab Control.", 20, 20)] Global $hTab GUISetState(@SW_SHOWNORMAL) Do Switch GUIGetMsg() Case $button_array[0] GUICtrlSetState($button_array[0], $GUI_HIDE) $hTab = _GUICtrlTab_Create($hWnd, 10, 10, 380, 280) _GUICtrlTab_InsertItem($hTab, 0, "Tab 1") $button_array[1] = GUICtrlCreateButton("Tab 1 Button", 30, 30) _GUICtrlTab_InsertItem($hTab, 1, "Tab 2") $button_array[2] = GUICtrlCreateButton("Tab 2 Button", 60, 60) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch Until False Edited August 14, 2016 by jaberwacky Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jaberwacky Posted August 13, 2016 Author Share Posted August 13, 2016 Nevermind. Helpfile says in GUISwitch: "Using the tabitemID allow to create new control in the specified tabitem control. Don't forget to close tabitem definition GUICtrlCreateTabItem("") " Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jaberwacky Posted August 13, 2016 Author Share Posted August 13, 2016 (edited) Sweet! Here is the working code. expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiTab.au3> #include <WindowsConstants.au3> Global $hWnd = GUICreate("Tab Experiment", 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) Global $button_array[3] = [GUICtrlCreateButton("Click To Create A Tab Control.", 20, 20)] Global $hTab GUISetState(@SW_SHOWNORMAL) Do Switch GUIGetMsg() Case $button_array[0] GUICtrlSetState($button_array[0], $GUI_HIDE) $hTab = GUICtrlCreateTab(10, 10, 380, 280) Global $idTabItem1 = GUICtrlCreateTabItem("Tab 1") Global $idTabItem2 = GUICtrlCreateTabItem("Tab 2") GUICtrlCreateTabItem('') GUISwitch($hWnd, $idTabItem1) $button_array[1] = GUICtrlCreateButton("Tab 1 Button", 20, 40) GUICtrlCreateTabItem('') GUISwitch($hWnd, $idTabItem2) $button_array[2] = GUICtrlCreateButton("Tab 2 Button", 90, 40) GUICtrlCreateTabItem('') Case $GUI_EVENT_CLOSE ExitLoop EndSwitch Until False Edited August 13, 2016 by jaberwacky Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
DStark Posted August 4, 2021 Share Posted August 4, 2021 Not to resurrect this thread, but this example works out of the box as of now. Thanks! Link to comment Share on other sites More sharing options...
Danp2 Posted August 4, 2021 Share Posted August 4, 2021 1 minute ago, DStark said: 4 years later... Not to resurrect this thread Too late! 😜 DStark and seadoggie01 2 Latest Webdriver UDF Release Webdriver Wiki FAQs 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