Jump to content
Sign in to follow this  
kalayaan

Notify on selecting a tab

Recommended Posts

kalayaan

I've searched, but didn't find a definitive answer (perhaps I missed it?). But my question is, how can I detect when a tab is clicked?

Doesn't seem to work with the normal GuiGetMsg(0).

Thanks.

Share this post


Link to post
Share on other sites
lte5000

Or here is an example of using the standard GUIGetMsg().

#include <GUIConstants.au3>

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

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 50, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 50, 70, 20)

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20)

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW)   ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50)

GUICtrlCreateTabItem("")   ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)

GUISetState()

; Run the GUI until the dialog is closed
While 1
        $msg = GUIGetMsg()
        Select 
                Case $msg = $tab
                        MsgBox(0, "", "Tab " & GUIRead($tab) & " was clicked.")
                Case $msg = $GUI_EVENT_CLOSE
                        ExitLoop
        EndSelect
Wend

Share this post


Link to post
Share on other sites
kalayaan

ControlCommand + CurrentTab

<{POST_SNAPBACK}>

Hmmm, I thought there would be a native Gui function to do it. :)

But thanks, Larry, that would do it for my application. (I see you you're still looking for a job).

EDIT: lte5000, thanks for the example. Just what I was looking for. :)

Edited by kalayaan

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.