Sign in to follow this  
Followers 0
duzers

Check which Tab is select with OnEventMode.

3 posts in this topic

Hello,

How I check which Tab is select with OnEventMode?

thx.

Share this post


Link to post
Share on other sites



You can now which tab selected by this way:

Snippet from code:

Case $Tab1
    Switch(GUICtrlRead($Tab1))
    Case 0 ;tabitem1
    ;somethink in eg
                    MsgBox(64,"","Switched To " & GUICtrlRead($Tab1))
    Case 1 ;tabitem 2
    ;do somethink in eg
                    MsgBox(64,"","Switched To " & GUICtrlRead($Tab1))
EndSwitch

More code is below:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("", 633, 447,-1,-1)
$Tab1 = GUICtrlCreateTab(0, 0, 95, 22) ;This is our Tab
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$TabSheet1 = GUICtrlCreateTabItem("Tab1") ;place here your more stuff.It will display only in this tabsheet1

$Label1=GUICtrlCreateLabel("LABEL: 1", 14, 40, 80, 18)
$TabSheet2 = GUICtrlCreateTabItem("Tab2") ;;place here your more stuff.It will display only in this tabsheet2
GUICtrlSetState(-1,$GUI_SHOW)
GUICtrlCreateLabel("", 10, 40, 200, 300, $SS_ETCHEDFRAME)
$labeltabitem2=GUICtrlCreateLabel("Display details:", 14, 40, 80, 18)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Tab1
    Switch(GUICtrlRead($Tab1))
    Case 0 ;tabitem1
    ;somethink in eg
                    MsgBox(64,"","Switched To " & GUICtrlRead($Tab1))
    Case 1 ;tabitem 2
    ;do somethink in eg
                    MsgBox(64,"","Switched To " & GUICtrlRead($Tab1))
EndSwitch
    EndSwitch
WEnd

[size="5"] [/size]

Share this post


Link to post
Share on other sites

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>

Opt("GUIOnEventMode", 1)

#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 355, 208, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Tab1 = GUICtrlCreateTab(8, 16, 329, 153)
GUICtrlSetOnEvent(-1, "Tab1Change")
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$TabSheet3 = GUICtrlCreateTabItem("TabSheet3")
$TabSheet4 = GUICtrlCreateTabItem("TabSheet4")
GUICtrlCreateTabItem("")
$Label1 = GUICtrlCreateLabel("", 99, 184, 156, 17, $SS_CENTER)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

Tab1Change()

While 1
    Sleep(100)
WEnd

Func Form1Close()
    Exit
EndFunc   ;==>Form1Close

Func Tab1Change()
    Local $hTab = GUICtrlGetHandle($Tab1), $sTabText
    $sTabText = _GUICtrlTab_GetItemText($hTab, GUICtrlRead($Tab1))
    GUICtrlSetData($Label1, $sTabText)
EndFunc   ;==>Tab1Change


GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

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