Jump to content

Another simple question about tabs


Recommended Posts

I want to be able to switch to another tab if some event occurs. Modded the help file but can't get the tabs to change, whats wrong?

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab1
Dim $msg, $button, $item = 0, $i

GUICreate("Tab Set Current Focus", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100)
$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateTabItem(""); end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab1")
GUICtrlSetState(-1, $GUI_SHOW); will be display first
GUICtrlCreateTabItem(""); end tabitem definition

$button = GUICtrlCreateButton("Set", 200, 130, 90, 30)

GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            _GUICtrlTabSetCurSel  ($tab0, $item)
            _GUICtrlTabSetCurFocus ($tab0, $item)
            $item = Not $item
    EndSelect
WEnd
Link to comment
Share on other sites

HI,

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab1
Dim $msg, $button, $item = 0, $i

GUICreate("Tab Set Current Focus", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100)
$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateTabItem(""); end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab1")
GUICtrlSetState(-1, $GUI_SHOW); will be display first
GUICtrlCreateTabItem(""); end tabitem definition

$button = GUICtrlCreateButton("Set", 200, 130, 90, 30)

GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            ;_GUICtrlTabSetCurSel($tab1, $item)
            _GUICtrlTabSetCurFocus($tab, $item)
            $item = Not $item
    EndSelect
WEnd

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

HI,

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            ;_GUICtrlTabSetCurSel($tab1, $item)
            _GUICtrlTabSetCurFocus($tab, $item)
            $item = Not $item
    EndSelect
WEnd

So long,

Mega

Ok, $tab is like index name an $item is tab number to be selected?

Works great now, thanks!

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...