Sign in to follow this  
Followers 0
Shuresh

Navigating Tab Control

12 posts in this topic

How to Navgate in different Tab Controls.. please check the attachement for clarification I need to open the next tab automatically...

Thanks

Shuresh

post-37480-1215126704_thumb.jpg

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

How to Navgate in different Tab Controls.. please check the attachement for clarification I need to open the next tab automatically...

Thanks

Shuresh

what do u need to do now?

If im geussing right u want it to show a differnt tab on startup or wenever jus us this:

GUICtrlSetState($TabVar , $GUI_SHOW)

Edited by tlokz

Share this post


Link to post
Share on other sites

The easiest way is to send a "RIGHT" key and that will open your next tab.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

The easiest way is to send a "RIGHT" key and that will open your next tab.

What if your focused on an input box? It won't work. The post before yours will.

Share this post


Link to post
Share on other sites

What if your focused on an input box? It won't work. The post before yours will.

Take a close look at the picture attached and you will see that the tab IS highlighted ... and it will work always (even when you can't get the tab handle).

The previous post assumed that either you can get the tab handle either the GUI was created by AutoIt ...


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Look at _GUICtrlTab_GetCurSel() / _GUICtrlTab_SetCurSel()...

#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

$GUI = GUICreate("Test Script", 300, 200)

$hTab = GUICtrlCreateTab(20, 10, 260, 150)

$Tab1 = GUICtrlCreateTabItem("Tab1")
$Tab2 = GUICtrlCreateTabItem("Tab2")
$Tab3 = GUICtrlCreateTabItem("Tab3")

;GUICtrlSetState($Tab2, $GUI_SHOW)

GUICtrlCreateTabItem("")

$Switch_Button = GUICtrlCreateButton("Switch Next", 20, 170, 80, 20)

GUISetState(@SW_SHOW, $GUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Switch_Button
            $iCurrent_TabIndex = _GUICtrlTab_GetCurSel($hTab)
            $iNext_TabIndex = $iCurrent_TabIndex
            
            Switch $iCurrent_TabIndex
                Case 0, 1
                    $iNext_TabIndex += 1
                Case 2
                    $iNext_TabIndex = 0
            EndSwitch
            
            _GUICtrlTab_SetCurSel($hTab, $iNext_TabIndex)
    EndSwitch
WEnd

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

And for the external usage:

#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

$GUI = GUICreate("Test Script", 300, 200)

$hTab = GUICtrlCreateTab(20, 10, 260, 150)

$Tab1 = GUICtrlCreateTabItem("Tab1")
$Tab2 = GUICtrlCreateTabItem("Tab2")
$Tab3 = GUICtrlCreateTabItem("Tab3")

GUICtrlCreateTabItem("")

$Switch_Button = GUICtrlCreateButton("Switch Next", 20, 170, 80, 20)

GUISetState(@SW_SHOW, $GUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Switch_Button
            ;This handle can by taken from any window that have standard SysTabControl
            $hWnd_Tab = ControlGetHandle("Test Script", "", "SysTabControl321")
            _GUICtrlTab_SwitchNext($hWnd_Tab)
    EndSwitch
WEnd

Func _GUICtrlTab_SwitchNext($hWnd)
    Local $iItems_Count = _GUICtrlTab_GetItemCount($hWnd)
    Local $iCurrent_TabIndex = _GUICtrlTab_GetCurSel($hWnd)
    Local $iNext_TabIndex = $iCurrent_TabIndex
    
    Switch $iCurrent_TabIndex
        Case 0 To $iItems_Count-2
            $iNext_TabIndex += 1
        Case Else
            $iNext_TabIndex = 0
    EndSwitch
    
    _GUICtrlTab_SetCurSel($hWnd, $iNext_TabIndex)
EndFunc

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

That is not created using Autoit GUI, and its thrid party software, I want to automate to move to next tab to set the parameter to display in screen.

So using Autoit I dono how to go next tab... becoz in Visible information I am not able to find any handle to control the swtiching of Tabs.. Since I am a starter pls help me out in this regards...

Thanks in Advance

Shuresh

what do u need to do now?

If im geussing right u want it to show a differnt tab on startup or wenever jus us this:

GUICtrlSetState($TabVar , $GUI_SHOW)

Share this post


Link to post
Share on other sites

Have you read all the posts? I already gave you a simple solution for that:

Get your tab control highlited (as it is shown in the image you posted) and send a "RIGHT" key to that application.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Have you tried what i posted? replace "My Title" with your window title, and try it:

#include <GuiTab.au3>

$hWnd_Tab = ControlGetHandle("My Title", "", "SysTabControl321")
_GUICtrlTab_SwitchNext($hWnd_Tab)

Func _GUICtrlTab_SwitchNext($hWnd)
    Local $iItems_Count = _GUICtrlTab_GetItemCount($hWnd)
    Local $iCurrent_TabIndex = _GUICtrlTab_GetCurSel($hWnd)
    Local $iNext_TabIndex = $iCurrent_TabIndex
    
    Switch $iCurrent_TabIndex
        Case 0 To $iItems_Count-2
            $iNext_TabIndex += 1
        Case Else
            $iNext_TabIndex = 0
    EndSwitch
    
    _GUICtrlTab_SetCurSel($hWnd, $iNext_TabIndex)
EndFunc

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Hi all, I've implemented the following code in one of my scripts. It successfully selects the tab itself - but the contents of the tab do not actually update. In other words - if I start on Tab 1, and then change to Tab2, Tab2 will appear selected but the contents of Tab1 stay visible. I've tried _WinAPI_RedrawWindow to see if that would help, but it appears not to.

Any thoughts?

Thanks!

Have you tried what i posted? replace "My Title" with your window title, and try it:

#include <GuiTab.au3>

$hWnd_Tab = ControlGetHandle("My Title", "", "SysTabControl321")
_GUICtrlTab_SwitchNext($hWnd_Tab)

Func _GUICtrlTab_SwitchNext($hWnd)
    Local $iItems_Count = _GUICtrlTab_GetItemCount($hWnd)
    Local $iCurrent_TabIndex = _GUICtrlTab_GetCurSel($hWnd)
    Local $iNext_TabIndex = $iCurrent_TabIndex
    
    Switch $iCurrent_TabIndex
        Case 0 To $iItems_Count-2
            $iNext_TabIndex += 1
        Case Else
            $iNext_TabIndex = 0
    EndSwitch
    
    _GUICtrlTab_SetCurSel($hWnd, $iNext_TabIndex)
EndFunc

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