Jump to content

Change tabs


Recommended Posts

Hello I got these tabs
 

Global $TabMain = GUICtrlCreateTabItem("Main")

Global $Action = GUICtrlCreateTabItem("Actions")

Global $TabThings = GUICtrlCreateTabItem("Things")

As we know to change tab we have to click with mouse on tab name like here it looks like below.

Is there possibility to change tab without click on the tab but change by click on button for example?

maxresdefault.jpg

Link to comment
Share on other sites

  • Moderators

Send a function call to _GUICtrlTab_ActivateTab or _GUICtrlTab_ClickTab after clicking the button maybe?

Not sure I understand completely, you showed a pic with no reference.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Extremely easy,  the answer already exists in the help file Example :)

#include <GUIConstantsEx.au3>

Example()

Func Example()
    GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    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)

    $tab1 = 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("") ; end tabitem definition

    $btn = GUICtrlCreateButton("click for tab 1", 20, 150, 100, 25)

    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()
        If $idMsg = $btn Then GUICtrlSetState($tab1, $GUI_SHOW)
        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example

 

Link to comment
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
 Share

×
×
  • Create New...