Jump to content

How to switch tabitem, detect change?

Recommended Posts

My GUI script has a window with three tabs. The first tab, "User Data", has a "Start" button at the bottom.

When you click the "Start" button, it calls the start() function.

The second tab, "Phase 1", has a couple of buttons. Each button runs another function. As each function completes, it updates the status line to "Complete".

The last tab, "Phase 2", has the same basic layout as the "Phase 1" tab.

The start() function basically just goes through and runs each of the button functions in sequential order.

Two questions:

1.) What is the best way for my start() function to to automatically switch between the tabs as it goes through the list of functions?

2.) Is there a way to detect and/or restrict when someone has clicked on a tab? My preference would be to have it start on the "User Data" tab, and not let anyone click on the other two tabs until they have hit the "Start" button.

Link to comment
Share on other sites

1) Use GuiSendMsg(...) with the right tab messages.... I'm slowly working on a list of messages

In the meantime you can try:

ControlCommand("window title","","SysTabControl321", "TabRight", "")

2) Save the return value of GUISetControl("tab",...) in a variable

Then have code like the following in

If GuiMsg(0) = $tabControl Then doSomething()

Sorry I can't give more details at the moment.

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Also, with this code, you set the TAB item what you want see at start.

For some reason I didn't have luck using your code, but I DID get it to work using one of the suggestions from Cyber Slug.

Here is what I did. I added the code to a function and called the function every time one of the buttons is pressed. This function make sure that the right tab has the focus, and if it is not, then move it.

Func gotoTab ( $tabName )

    Dim $currentTab
    Dim $userdatatab = 1
    Dim $phaseonetab = 2
    Dim $phasetwotab = 3
    Dim $thetav
    If $tabName = 'Phase One' Then
  $thetab = $phaseonetab
    ElseIf $tabName = 'Phase Two' Then
  $thetab = $phasetwotab

    ControlFocus ( $title, '', 'SysTabControl321' )
    $currentTab = ControlCommand ( $title, '', 'SysTabControl321', 'CurrentTab', '' )
    If $thetab <> $currentTab Then
  If $currentTab = $userdatatab And $thetab = $phaseonetab Then
     ControlFocus ( $title, '', 'SysTabControl321' )
     ControlCommand ( $title, '', 'SysTabControl321', 'TabRight', '' )
  ElseIf $currentTab = $userdatatab And $thetab = $phasetwotab Then
     ControlFocus ( $title, '', 'SysTabControl321' )
     ControlCommand ( $title, '', 'SysTabControl321', 'TabRight', '' )
     ControlFocus ( $title, '', 'SysTabControl321' )
     ControlCommand ( $title, '', 'SysTabControl321', 'TabRight', '' )
  ElseIf $currentTab = $phaseonetab And $thetab = $phasetwotab Then
     ControlFocus ( $title, '', 'SysTabControl321' )
     ControlCommand ( $title, '', 'SysTabControl321', 'TabRight', '' )
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

  • Recently Browsing   0 members

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