<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.autoitscript.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Terenz</id>
	<title>AutoIt Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.autoitscript.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Terenz"/>
	<link rel="alternate" type="text/html" href="https://www.autoitscript.com/wiki/Special:Contributions/Terenz"/>
	<updated>2026-04-03T22:00:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.autoitscript.com/w/index.php?title=Tabs&amp;diff=13487</id>
		<title>Tabs</title>
		<link rel="alternate" type="text/html" href="https://www.autoitscript.com/w/index.php?title=Tabs&amp;diff=13487"/>
		<updated>2016-07-02T13:27:59Z</updated>

		<summary type="html">&lt;p&gt;Terenz: /* Tab switching with CTRL+TAB / CTRL+SHIFT+TAB */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Tabs And How To Deal With Them=&lt;br /&gt;
&lt;br /&gt;
Tabs are a valuable tool when you need to fit a lot of controls into a small GUI.  But inexperienced users often have problems with them - particularly in making sure that controls only appear on the correct tab.  This tutorial should help. Before going further, it is important to understand the differences between controls created using the built-in AutoIt commands (&#039;&#039;GUICtrlCreate*&#039;&#039;) and those created with the UDFs.  The built-in commands produce controls which are managed internally by AutoIt - they return &#039;&#039;&#039;ControlID&#039;&#039;&#039;s.  The UDF commands create controls that are not in Autoit&#039;s internal management structure and need to be managed by the code - they normally return &#039;&#039;&#039;handles&#039;&#039;&#039; (the special unique identifier for all Windows components).&lt;br /&gt;
&lt;br /&gt;
=Tabs Created With Native AutoIt Functions=&lt;br /&gt;
&lt;br /&gt;
Any tabs created by the built-in AutoIt commands &#039;&#039;GUICtrlCreateTab/TabItem&#039;&#039; will automatically take care of displaying any built-in controls created at the same time within the tab creation structure.  Here is an example:&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$hGUI = GUICreate(&amp;quot;Built-In Tab Example&amp;quot;, 500, 500)&lt;br /&gt;
&lt;br /&gt;
$hTab = GUICtrlCreateTab(10, 10, 480, 480)&lt;br /&gt;
; Create tabitems&lt;br /&gt;
For $i = 0 To 2&lt;br /&gt;
    GUICtrlCreateTabItem(&amp;quot;Tab &amp;quot; &amp;amp; $i)&lt;br /&gt;
    GUICtrlCreateButton(&amp;quot;Button &amp;quot; &amp;amp; $i, 20 + ($i * 100), 40 + ($i * 50), 80, 30)&lt;br /&gt;
Next&lt;br /&gt;
; Close Tab definiton&lt;br /&gt;
GUICtrlCreateTabItem(&amp;quot;&amp;quot;) &lt;br /&gt;
&lt;br /&gt;
GUISetState()&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    Switch GUIGetMsg()&lt;br /&gt;
        Case $GUI_EVENT_CLOSE&lt;br /&gt;
            Exit&lt;br /&gt;
    EndSwitch&lt;br /&gt;
WEnd&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As you can see, the controls for each tab are created just after the TabItem on which they are to appear and before the next TabItem.  Do not forget to close the Tab definition - many tab problems are caused by omitting this vital line.&lt;br /&gt;
&lt;br /&gt;
What happens if we add some UDF created controls to these tabs?&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
 #Include &amp;lt;GuiButton.au3&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $hGUI = GUICreate(&amp;quot;Built-In Tab Example&amp;quot;, 500, 500)&lt;br /&gt;
 &lt;br /&gt;
 $hTab = GUICtrlCreateTab(10, 10, 480, 480)&lt;br /&gt;
 ; Create tabitems&lt;br /&gt;
 For $i = 0 To 2&lt;br /&gt;
     GUICtrlCreateTabItem(&amp;quot;Tab &amp;quot; &amp;amp; $i)&lt;br /&gt;
     GUICtrlCreateButton(&amp;quot;Built-In &amp;quot; &amp;amp; $i, 20 + ($i * 100), 40 + ($i * 50), 80, 30)&lt;br /&gt;
     _GUICtrlButton_Create($hGUI, &amp;quot;UDF &amp;quot; &amp;amp; $i, 20 + ($i * 100), 80 + ($i * 50),80, 30)&lt;br /&gt;
 Next&lt;br /&gt;
 ; Close Tab definiton&lt;br /&gt;
 GUICtrlCreateTabItem(&amp;quot;&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 GUISetState()&lt;br /&gt;
 &lt;br /&gt;
 While 1&lt;br /&gt;
     Switch GUIGetMsg()&lt;br /&gt;
         Case $GUI_EVENT_CLOSE&lt;br /&gt;
             Exit&lt;br /&gt;
     EndSwitch&lt;br /&gt;
 WEnd&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As you can see, the UDF created controls appear on every tab.  Remember this is because they are not part of the internal AutoIt control management structure, so AutoIt does not know how to handle them.  It is up to you to manage them by seeing which tab is active and hiding/showing these controls as required:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
 #Include &amp;lt;GuiButton.au3&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Global $hButtons[3]&lt;br /&gt;
 &lt;br /&gt;
 $hGUI = GUICreate(&amp;quot;Built-In Tab Example&amp;quot;, 500, 500)&lt;br /&gt;
 &lt;br /&gt;
 $hTab = GUICtrlCreateTab(10, 10, 480, 480)&lt;br /&gt;
 ; Create tabitems&lt;br /&gt;
 For $i = 0 To 2&lt;br /&gt;
     GUICtrlCreateTabItem(&amp;quot;Tab &amp;quot; &amp;amp; $i)&lt;br /&gt;
     GUICtrlCreateButton(&amp;quot;Built-In &amp;quot; &amp;amp; $i, 20 + ($i * 100), 40 + ($i * 50), 80, 30)&lt;br /&gt;
     ; Add a label to the first tab&lt;br /&gt;
     If $i = 0 Then GUICtrlCreateLabel(&amp;quot;See how &#039;laggy&#039; the UDF buttons are when selecting this tab because of using WinSetState&amp;quot;, 20, 200, 150, 60)&lt;br /&gt;
 Next&lt;br /&gt;
 &lt;br /&gt;
 GUICtrlCreateTabItem(&amp;quot;&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 ; Create UDF controls&lt;br /&gt;
 For $i = 0 To 2&lt;br /&gt;
     $hButtons[$i] = _GUICtrlButton_Create($hGUI, &amp;quot;UDF &amp;quot; &amp;amp; $i, 20 + ($i * 100), 80 + ($i * 50),80, 30)&lt;br /&gt;
 Next&lt;br /&gt;
 &lt;br /&gt;
 ; Hide the controls so only the one on the first tab is visible&lt;br /&gt;
 WinSetState($hButtons[1], &amp;quot;&amp;quot;, @SW_HIDE)&lt;br /&gt;
 WinSetState($hButtons[2], &amp;quot;&amp;quot;, @SW_HIDE)&lt;br /&gt;
 &lt;br /&gt;
 GUISetState()&lt;br /&gt;
 &lt;br /&gt;
 ; This is the current active tab&lt;br /&gt;
 $iLastTab = 0&lt;br /&gt;
 &lt;br /&gt;
 While 1&lt;br /&gt;
     Switch GUIGetMsg()&lt;br /&gt;
         Case $GUI_EVENT_CLOSE&lt;br /&gt;
             Exit&lt;br /&gt;
         Case $hTab&lt;br /&gt;
             ; Check which Tab is active&lt;br /&gt;
             $iCurrTab = GUICtrlRead($hTab)&lt;br /&gt;
             ; If the Tab has changed&lt;br /&gt;
             If $iCurrTab &amp;lt;&amp;gt; $iLastTab Then&lt;br /&gt;
                 ; Show/Hide controls as required&lt;br /&gt;
                 Switch $iCurrTab&lt;br /&gt;
                     Case 0&lt;br /&gt;
                         ; Note lag when WinSetState is used&lt;br /&gt;
                         WinSetState($hButtons[1], &amp;quot;&amp;quot;, @SW_HIDE)&lt;br /&gt;
                         WinSetState($hButtons[2], &amp;quot;&amp;quot;, @SW_HIDE)&lt;br /&gt;
                         WinSetState($hButtons[0], &amp;quot;&amp;quot;, @SW_SHOW)&lt;br /&gt;
                     Case 1&lt;br /&gt;
                         ; No lag when using ControlHide/Show&lt;br /&gt;
                         ControlHide($hGUI, &amp;quot;&amp;quot;, $hButtons[0])&lt;br /&gt;
                         ControlHide($hGUI, &amp;quot;&amp;quot;, $hButtons[2])&lt;br /&gt;
                         ControlShow($hGUI, &amp;quot;&amp;quot;, $hButtons[1])&lt;br /&gt;
                     Case 2&lt;br /&gt;
                         ; Nor when using this DLL&lt;br /&gt;
                         DllCall(&amp;quot;User32.dll&amp;quot;, &amp;quot;bool&amp;quot;, &amp;quot;ShowWindowAsync&amp;quot;, &amp;quot;hwnd&amp;quot;, $hButtons[0], &amp;quot;int&amp;quot;, @SW_HIDE)&lt;br /&gt;
                         DllCall(&amp;quot;User32.dll&amp;quot;, &amp;quot;bool&amp;quot;, &amp;quot;ShowWindowAsync&amp;quot;, &amp;quot;hwnd&amp;quot;, $hButtons[1], &amp;quot;int&amp;quot;, @SW_HIDE)&lt;br /&gt;
                         DllCall(&amp;quot;User32.dll&amp;quot;, &amp;quot;bool&amp;quot;, &amp;quot;ShowWindowAsync&amp;quot;, &amp;quot;hwnd&amp;quot;, $hButtons[2], &amp;quot;int&amp;quot;, @SW_SHOW)&lt;br /&gt;
 &lt;br /&gt;
                 EndSwitch&lt;br /&gt;
                 ; Store the value for future comparisons&lt;br /&gt;
                 $iLastTab = $iCurrTab&lt;br /&gt;
             EndIf&lt;br /&gt;
     EndSwitch&lt;br /&gt;
 WEnd&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note the lag in hiding/showing the UDF created controls if you use &#039;&#039;WinSetState&#039;&#039; - I would recommend using &#039;&#039;ControlShow/Hide&#039;&#039; which gives an instantaneous response.  Also how you do not need to create the UDF controls within the tab creation structure - as you have to look after them, there is no requirement to do so.&lt;br /&gt;
&lt;br /&gt;
=Tabs Created With UDFs=&lt;br /&gt;
&lt;br /&gt;
Now let us look at Tabs created with the &#039;&#039;GUITab&#039;&#039; UDF.  In this case you need to manage all of the controls on the tabs yourself, even if they are created using the built-in commands:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
 #Include &amp;lt;GuiButton.au3&amp;gt;&lt;br /&gt;
 #include &amp;lt;GuiTab.au3&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Global $hBuiltIn_Buttons[3]&lt;br /&gt;
 Global $hUDF_Buttons[3]&lt;br /&gt;
 &lt;br /&gt;
 $hGUI = GUICreate(&amp;quot;Built-In Tab Example&amp;quot;, 500, 500)&lt;br /&gt;
 &lt;br /&gt;
 $hTab = _GUICtrlTab_Create($hGUI, 10, 10, 480, 480)&lt;br /&gt;
 GUISetState()&lt;br /&gt;
 &lt;br /&gt;
 ; Add tabs&lt;br /&gt;
 _GUICtrlTab_InsertItem($hTab, 0, &amp;quot;Tab 0&amp;quot;)&lt;br /&gt;
 _GUICtrlTab_InsertItem($hTab, 1, &amp;quot;Tab 1&amp;quot;)&lt;br /&gt;
 _GUICtrlTab_InsertItem($hTab, 2, &amp;quot;Tab 2&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 ; Create the Built-in and UDF buttons&lt;br /&gt;
 For $i = 0 To 2&lt;br /&gt;
     $hBuiltIn_Buttons[$i] = GUICtrlCreateButton(&amp;quot;Button &amp;quot; &amp;amp; $i, 20 + ($i * 100), 40 + ($i * 50), 80, 30)&lt;br /&gt;
     $hUDF_Buttons[$i] = _GUICtrlButton_Create($hGUI, &amp;quot;UDF &amp;quot; &amp;amp; $i, 20 + ($i * 100), 80 + ($i * 50),80, 30)&lt;br /&gt;
 Next&lt;br /&gt;
 &lt;br /&gt;
 ; Hide the controls so only the one on the first tab is visible&lt;br /&gt;
 GUICtrlSetState($hBuiltIn_Buttons[1], $GUI_HIDE)&lt;br /&gt;
 GUICtrlSetState($hBuiltIn_Buttons[2], $GUI_HIDE)&lt;br /&gt;
 ControlHide($hGUI, &amp;quot;&amp;quot;, $hUDF_Buttons[1])&lt;br /&gt;
 ControlHide($hGUI, &amp;quot;&amp;quot;, $hUDF_Buttons[2])&lt;br /&gt;
 &lt;br /&gt;
 GUISetState()&lt;br /&gt;
 &lt;br /&gt;
 ; This is the current active tab&lt;br /&gt;
 $iLastTab = 0&lt;br /&gt;
 &lt;br /&gt;
 While 1&lt;br /&gt;
     Switch GUIGetMsg()&lt;br /&gt;
         Case $GUI_EVENT_CLOSE&lt;br /&gt;
             Exit&lt;br /&gt;
     EndSwitch&lt;br /&gt;
 &lt;br /&gt;
     ; Check which Tab is active&lt;br /&gt;
     $iCurrTab = _GUICtrlTab_GetCurFocus($hTab)&lt;br /&gt;
     ; If the Tab has changed&lt;br /&gt;
     If $iCurrTab &amp;lt;&amp;gt; $iLastTab Then&lt;br /&gt;
         ; Store the value for future comparisons&lt;br /&gt;
         $iLastTab = $iCurrTab&lt;br /&gt;
         ; Show/Hide controls as required&lt;br /&gt;
         Switch $iCurrTab&lt;br /&gt;
             Case 0&lt;br /&gt;
                 GUICtrlSetState($hBuiltIn_Buttons[1], $GUI_HIDE)&lt;br /&gt;
                 GUICtrlSetState($hBuiltIn_Buttons[2], $GUI_HIDE)&lt;br /&gt;
                 GUICtrlSetState($hBuiltIn_Buttons[0], $GUI_SHOW)&lt;br /&gt;
                 ControlHide($hGUI, &amp;quot;&amp;quot;, $hUDF_Buttons[1])&lt;br /&gt;
                 ControlHide($hGUI, &amp;quot;&amp;quot;, $hUDF_Buttons[2])&lt;br /&gt;
                 ControlShow($hGUI, &amp;quot;&amp;quot;, $hUDF_Buttons[0])&lt;br /&gt;
             Case 1&lt;br /&gt;
                 GUICtrlSetState($hBuiltIn_Buttons[0], $GUI_HIDE)&lt;br /&gt;
                 GUICtrlSetState($hBuiltIn_Buttons[2], $GUI_HIDE)&lt;br /&gt;
                 GUICtrlSetState($hBuiltIn_Buttons[1], $GUI_SHOW)&lt;br /&gt;
                 ControlHide($hGUI, &amp;quot;&amp;quot;, $hUDF_Buttons[0])&lt;br /&gt;
                 ControlHide($hGUI, &amp;quot;&amp;quot;, $hUDF_Buttons[2])&lt;br /&gt;
                 ControlShow($hGUI, &amp;quot;&amp;quot;, $hUDF_Buttons[1])&lt;br /&gt;
            Case 2&lt;br /&gt;
                 GUICtrlSetState($hBuiltIn_Buttons[0], $GUI_HIDE)&lt;br /&gt;
                 GUICtrlSetState($hBuiltIn_Buttons[1], $GUI_HIDE)&lt;br /&gt;
                 GUICtrlSetState($hBuiltIn_Buttons[2], $GUI_SHOW)&lt;br /&gt;
                 ControlHide($hGUI, &amp;quot;&amp;quot;, $hUDF_Buttons[0])&lt;br /&gt;
                 ControlHide($hGUI, &amp;quot;&amp;quot;, $hUDF_Buttons[1])&lt;br /&gt;
                 ControlShow($hGUI, &amp;quot;&amp;quot;, $hUDF_Buttons[2])&lt;br /&gt;
         EndSwitch&lt;br /&gt;
     EndIf&lt;br /&gt;
 WEnd&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A lot of work but a very satisfactory result.  Note the need to use different commands to hide/show the built-in and UDF created controls to avoid &amp;quot;lag&amp;quot; on the latter as was shown in the earlier example.&lt;br /&gt;
&lt;br /&gt;
So, a couple of lessons to draw from this:&lt;br /&gt;
&lt;br /&gt;
- 1.  When using tabs, try and use built-in commands if at all possible.  If you do, AutoIt looks after the showing/hiding problem for you as long as you create the controls &#039;&#039;within&#039;&#039; the tab creation structure.  See the next section for how to add controls to tabs after their creation.&lt;br /&gt;
&lt;br /&gt;
- 2.  If you must use UDF created controls for any reason, you have to manage hiding/showing all controls yourself.&lt;br /&gt;
&lt;br /&gt;
=Adding Controls To Tabs After Creation=&lt;br /&gt;
&lt;br /&gt;
If you need to add built-in controls to a tab after the tabs have already been created, then you &#039;&#039;must&#039;&#039; use &#039;&#039;GUISwitch&#039;&#039; with the &#039;&#039;tabitemID&#039;&#039; parameter to select the correct tab before you create the control or you will find that it is visible on all tabs.&lt;br /&gt;
&lt;br /&gt;
Here is an example to show how to do it:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$hGUI = GUICreate(&amp;quot;Test&amp;quot;, 500, 500)&lt;br /&gt;
&lt;br /&gt;
$cTab = GUICtrlCreateTab(10, 10, 480, 350)&lt;br /&gt;
$cTab_0 = GUICtrlCreateTabItem(&amp;quot;Tab 0&amp;quot;)&lt;br /&gt;
$cTab_1 = GUICtrlCreateTabItem(&amp;quot;Tab 1&amp;quot;)&lt;br /&gt;
GUICtrlCreateTabItem(&amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
$cButton = GUICtrlCreateButton(&amp;quot;Add controls&amp;quot;, 10, 450, 80, 30)&lt;br /&gt;
&lt;br /&gt;
GUISetState()&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
	Switch GUIGetMsg()&lt;br /&gt;
		Case $GUI_EVENT_CLOSE&lt;br /&gt;
			Exit&lt;br /&gt;
		Case $cButton&lt;br /&gt;
			; Correct&lt;br /&gt;
			GUISwitch($hGUI, $cTab_0)&lt;br /&gt;
			GUICtrlCreateLabel(&amp;quot;Only on Tab 0&amp;quot;, 40, 40, 200, 20)&lt;br /&gt;
			GUICtrlSetBkColor(-1, 0xCCFFCC)&lt;br /&gt;
			GUICtrlCreateTabItem(&amp;quot;&amp;quot;)&lt;br /&gt;
			GUISwitch($hGUI)&lt;br /&gt;
			; Incorrect&lt;br /&gt;
			GUICtrlCreateLabel(&amp;quot;OnTab 0 AND Tab 1&amp;quot;, 40, 100, 200, 20)&lt;br /&gt;
			GUICtrlSetBkColor(-1, 0xFFCCCC)&lt;br /&gt;
	EndSwitch&lt;br /&gt;
WEnd&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Do not forget to reclose the tab definition after adding the new controls.&lt;br /&gt;
&lt;br /&gt;
=Multiple Tabs In A GUI=&lt;br /&gt;
&lt;br /&gt;
Unfortunately, only one built-in tab control can be created per GUI - you cannot have several tabs on a single GUI.  But there is a way around this - just create child GUIs which can each hold a tab:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
 #include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $hGUI = GUICreate(&amp;quot;Test&amp;quot;, 500, 500)&lt;br /&gt;
 &lt;br /&gt;
 GUISetState()&lt;br /&gt;
 &lt;br /&gt;
 ; Create child GUIs to hold tabs&lt;br /&gt;
 $hTab_Win0 = GUICreate(&amp;quot;&amp;quot;, 400, 200, 50, 20, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)&lt;br /&gt;
 $hTab_0 = GUICtrlCreateTab(10, 10, 380, 180)&lt;br /&gt;
     $hTab_00 = GUICtrlCreateTabitem(&amp;quot;00&amp;quot;)&lt;br /&gt;
         GUICtrlCreateButton(&amp;quot;00&amp;quot;, 160, 90, 80, 30)&lt;br /&gt;
     $hTab_01 = GUICtrlCreateTabitem(&amp;quot;01&amp;quot;)&lt;br /&gt;
         GUICtrlCreateButton(&amp;quot;01&amp;quot;, 160, 90, 80, 30)&lt;br /&gt;
 &lt;br /&gt;
 GUICtrlCreateTabitem (&amp;quot;&amp;quot;)&lt;br /&gt;
 GUISetState()&lt;br /&gt;
 &lt;br /&gt;
 $hTab_Win1 = GUICreate(&amp;quot;&amp;quot;, 400, 200, 50, 250, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)&lt;br /&gt;
 $hTab_1 = GUICtrlCreateTab(10, 10, 380, 180)&lt;br /&gt;
     $hTab_10 = GUICtrlCreateTabitem(&amp;quot;10&amp;quot;)&lt;br /&gt;
         GUICtrlCreateButton(&amp;quot;10&amp;quot;, 160, 90, 80, 30)&lt;br /&gt;
     $hTab_11 = GUICtrlCreateTabitem(&amp;quot;11&amp;quot;)&lt;br /&gt;
         GUICtrlCreateButton(&amp;quot;11&amp;quot;, 160, 90, 80, 30)&lt;br /&gt;
 GUICtrlCreateTabitem (&amp;quot;&amp;quot;)&lt;br /&gt;
 GUISetState()&lt;br /&gt;
 &lt;br /&gt;
 While 1&lt;br /&gt;
     Switch GUIGetMsg()&lt;br /&gt;
         Case $GUI_EVENT_CLOSE&lt;br /&gt;
             Exit&lt;br /&gt;
     EndSwitch&lt;br /&gt;
 WEnd&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Easy when you know how!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Tab switching with CTRL+TAB / CTRL+SHIFT+TAB=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;TabConstants.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Global $aTab[3]&lt;br /&gt;
&lt;br /&gt;
$hGUI = GUICreate(&amp;quot;Test&amp;quot;, 500, 500)&lt;br /&gt;
&lt;br /&gt;
$cTab = GUICtrlCreateTab(10, 10, 480, 200)&lt;br /&gt;
&lt;br /&gt;
$aTab[0] = GUICtrlCreateTabItem(&amp;quot;Tab 0&amp;quot;)&lt;br /&gt;
$aTab[1] = GUICtrlCreateTabItem(&amp;quot;Tab 1&amp;quot;)&lt;br /&gt;
$aTab[2] = GUICtrlCreateTabItem(&amp;quot;Tab 2&amp;quot;)&lt;br /&gt;
GUICtrlCreateTabItem(&amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
$cTab_Right = GUICtrlCreateDummy()&lt;br /&gt;
$cTab_Left = GUICtrlCreateDummy()&lt;br /&gt;
&lt;br /&gt;
GUISetState()&lt;br /&gt;
&lt;br /&gt;
Global $aAccelKeys[2][2] = [[&amp;quot;^{TAB}&amp;quot;, $cTab_Right],[&amp;quot;^+{TAB}&amp;quot;, $cTab_Left]]&lt;br /&gt;
GUISetAccelerators($aAccelKeys)&lt;br /&gt;
&lt;br /&gt;
While 1&lt;br /&gt;
    Switch GUIGetMsg()&lt;br /&gt;
        Case $GUI_EVENT_CLOSE&lt;br /&gt;
            Exit&lt;br /&gt;
        Case $cTab_Right&lt;br /&gt;
            $iTab = GUICtrlRead($cTab) + 1&lt;br /&gt;
            If $iTab &amp;gt; (UBound($aTab) - 1) Then $iTab = 0&lt;br /&gt;
            GUICtrlSendMsg($cTab, $TCM_SETCURFOCUS, $iTab, 0) &lt;br /&gt;
        Case $cTab_Left&lt;br /&gt;
            $iTab = GUICtrlRead($cTab) - 1&lt;br /&gt;
            If $iTab &amp;lt; 0 Then $iTab = UBound($aTab) - 1&lt;br /&gt;
            GUICtrlSendMsg($cTab, $TCM_SETCURFOCUS, $iTab, 0) &lt;br /&gt;
    EndSwitch&lt;br /&gt;
WEnd&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Based on Melba23 code from [http://www.autoitscript.com/forum/topic/161912-tab-switching-with-ctrltab-ctrlshifttab/#entry1175870 Tab switching with CTRL+TAB / CTRL+SHIFT+TAB]&lt;br /&gt;
&lt;br /&gt;
=Related links=&lt;br /&gt;
Below Links to interesting topics in the forum related to the use of Tab&lt;br /&gt;
* [http://www.autoitscript.com/forum/index.php?showtopic=159156 Tab BG Colour]&lt;br /&gt;
* [http://www.autoitscript.com/forum/index.php?showtopic=177522 GUICtrlSetTip with Multi Lines for TabItems]&lt;br /&gt;
* [http://www.autoitscript.com/forum/index.php?showtopic=160716 How to detect when a Tab loses focus ?]&lt;br /&gt;
* [http://www.autoitscript.com/forum/index.php?showtopic=162353 Tab control with Richedit]&lt;br /&gt;
* [http://www.autoitscript.com/forum/index.php?showtopic=162353 Resize tabs relative to GUI width]&lt;br /&gt;
* [http://www.autoitscript.com/forum/index.php?showtopic=178860 GUISetAccelerators click on two buttons on different TabItem]&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
Tabs are useful controls, but can be difficult to master.  After this tutorial you should be well on your way!&lt;br /&gt;
&lt;br /&gt;
[[Category:GUI]]&lt;/div&gt;</summary>
		<author><name>Terenz</name></author>
	</entry>
</feed>