Sign in to follow this  
Followers 0
Fire

How correctly Switch to tab item and display msgbox?

3 posts in this topic

#1 ·  Posted (edited)

Hi to all.

Dears i create sample GUI script with tabitems.

My target is : on switch from tabitem1 to tabitem2 and display msgbox.(see below script it`s sample)

So, i cant figure it out.

Pliz anybody know another way to do somethink like what i want to do? or is here another way to do it?

Sample here is:

#include <GUIConstants.au3>
#include <TabConstants.au3>


$Form2 = GUICreate("Sample", 455, 322, 334, 141)
$Tab1 = GUICtrlCreateTab(8, 0, 433, 21)
$tabitem1=GUICtrlCreateTabItem("Windows GPO ")
$tabitem2=GUICtrlCreateTabItem("Starup Editor")
GUISetState(@SW_SHOW)


While 1
        $msg = GUIGetMsg()
    Switch $msg
    case $GUI_EVENT_CLOSE 
        ExitLoop
        case  $tabitem1
            
            MsgBox(0,"TABITEM 1 SELECTED","TABITEM 1 SELECTED")
            
            case $tabitem2 
                MsgBox(0,"TABITEM 2 SELECTED","TABITEM 2 sELECTED")
        
        EndSwitch
    WEnd

Any tips will greatly appreciated.

Thanks very much & Mery Christmas to all AutoIt International Community:)

Edited by Sh3llC043r

[size="5"] [/size]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Like this?

#include <GUIConstants.au3>

$Form2 = GUICreate("Sample", 455, 322, 334, 141)
$Tab1 = GUICtrlCreateTab(8, 0, 433, 21)
$tabitem1 = GUICtrlCreateTabItem("Windows GPO ")
$tabitem2 = GUICtrlCreateTabItem("Starup Editor")
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Tab1
            Switch GUICtrlRead($Tab1)
                Case 0
                    MsgBox(0,"TABITEM 1 SELECTED","TABITEM 1 SELECTED")
                Case 1
                    MsgBox(0,"TABITEM 2 SELECTED","TABITEM 2 SELECTED")
            EndSwitch
    EndSwitch
WEnd

Edit: Also please try the helpfile next time you have a question, this is exactly what the example for GUICtrlCreateTabItem() does.

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks bro AdmiralAlkex

Yes your sample is that what i want to do.Thank you very much.Now i understand DAO of Tabitems.

Thanks Again.

Edit: Also please try the helpfile next time you have a question, this is exactly what the example for GUICtrlCreateTabItem() does.

I`m Really sorry for this isuse:) May be i was drink so much ;) .

Thanks .

Edited by Sh3llC043r

[size="5"] [/size]

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