Jump to content

Recommended Posts

Posted

I found that ctrl+tab and ctrl+shift+tab not works on tabs created by autoit.

It should switch to next/previous tab but it just works like a normal tab, jump to the next control.

Is that a bug or there are some options for it?

Posted

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

Global $hGUI, $Tab, $TabRight, $TabLeft
Global $aAccelerator[2][2]
Global $aTabs[21] = [20]

$hGUI = GUICreate('Test', 400, 500)
$Tab = GUICtrlCreateTab(0, 0, 400, 500)
$TabRight = GUICtrlCreateDummy()
$TabLeft = GUICtrlCreateDummy()

For $i = 1 To $aTabs[0]
    $aTabs[$i] = GUICtrlCreateTabItem('Tab ' & $i)
Next
GUICtrlCreateTabItem("")

$aAccelerator[0][0] = '^{TAB}'
$aAccelerator[0][1] = $TabRight
$aAccelerator[1][0] = '^+{TAB}'
$aAccelerator[1][1] = $TabLeft
GUISetAccelerators($aAccelerator, $hGUI)

GUISetState()
Sleep(1000)

While 1
    Switch GUIGetMsg()
        Case $TabRight
            Local $iIndex = GUICtrlRead($Tab)+1
            If $iIndex >= $aTabs[0] Then $iIndex = 0
            GUICtrlSendMsg($Tab, $TCM_SETCURSEL, $iIndex, 0)
            
        Case $TabLeft
            Local $iIndex = GUICtrlRead($Tab)-1
            If $iIndex < 0 Then $iIndex = $aTabs[0]-1
            GUICtrlSendMsg($Tab, $TCM_SETCURSEL, $iIndex, 0)
        
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

GUIDelete()
Exit

Posted

wow thanks, that's beautiful and it works fine.

So it's not a native function of tab control?

I thought it was :S

Posted (edited)

Case $TabRight
            Local $iIndex = GUICtrlRead($Tab)+1
            If $iIndex >= $aTabs[0] Then $iIndex = 0
            GUICtrlSendMsg($Tab, $TCM_SETCURSEL, $iIndex, 0)

It should be $TCM_SETCURFOCUS here to make the content in tab change.

SetCurSel only change the selected tab, but not the contents, that's weird.

Edited by rexx
Posted

You could also have looked at

ControlCommand ( "title", "text", $Tab, "TabRight", "");; Or "TabLeft" depending on the direction you want to go.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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...