Sign in to follow this  
Followers 0
AustrianOak

How do I create multiple tabs?

5 posts in this topic

I tried creating multiple tabs so I can have two of them in separate locations but on the same window and was unsuccessful.

What format of code do I create my tabs in and is it possible?

:)

Share this post


Link to post
Share on other sites



I had a go but it won't work so I'd like the answer too.

#include <GUIConstantsEx.au3>

#region - GUI Create
GUICreate("Tab Test", 225, 110)
GUICtrlCreateTab(5, 5, 100, 100)
GUICtrlCreateTabItem("Tab1-1")
GUICtrlCreateTab(110, 5, 100, 100)
GUICtrlCreateTabItem("Tab2-1")
GUISetState()
#endregion

#region - GUI SelectLoop
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
#endregion

Posted Image

Share this post


Link to post
Share on other sites

From the help file under GuiCtrlCreateTab():

ONLY one Tab control can be created by window. But a script can creates several windows having a tab in.

Now, that only applies to the built-in Tab functions. You have more power, and MUCH more complexity if you use the UDF:
#include <GuiConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <WindowsConstants.au3>

Opt("GuiOnEventMode", 1)

$hGUI = GUICreate("Test", 640, 480)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")

$hTab_1 = _GUICtrlTab_Create($hGUI, 20, 20, 290, 390)
$IdxTabItem_1_0 = _GUICtrlTab_InsertItem($hTab_1, 0,"Tab 1-0")
$IdxTabItem_1_1 = _GUICtrlTab_InsertItem($hTab_1, 1, "Tab 1-1")

$hTab_2 = _GUICtrlTab_Create($hGUI, 330, 20, 290, 390)
$IdxTabItem_2_0 = _GUICtrlTab_InsertItem($hTab_2, 0, "Tab 2-0")
$IdxTabItem_2_1 = _GUICtrlTab_InsertItem($hTab_2, 1, "Tab 2-1")

GUISetState()

ConsoleWrite("Debug: $hGUI = " & $hGUI & @LF)

ConsoleWrite("Debug: $hTab_1 = " & $hTab_1 & @LF)
ConsoleWrite("Debug: $IdxTabItem_1_0 = " & $IdxTabItem_1_0 & @LF)
ConsoleWrite("Debug: $IdxTabItem_1_1 = " & $IdxTabItem_1_1 & @LF)

ConsoleWrite("Debug: $hTab_2 = " & $hTab_2 & @LF)
ConsoleWrite("Debug: $IdxTabItem_2_0 = " & $IdxTabItem_2_0 & @LF)
ConsoleWrite("Debug: $IdxTabItem_2_1 = " & $IdxTabItem_2_1 & @LF)

While 1
    Sleep(20)
WEnd

Func _Quit()
    Exit
EndFunc

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

if you use the UDF

I didn't even think of checking the UDFs Posted Image

Share this post


Link to post
Share on other sites

Thanks PsaltyDS

:]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0