Jump to content

Unable to select a tab?


Recommended Posts

I've been trying to use a button in autoit to select a tab in my GUI. From what I read, this code should work perfectly, but when I press my button, I'm not taken to my tab. Any ideas?

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#include <GUIConstantsEx.au3>
#include <IE.au3>

Func trace($input)
    ConsoleWrite($input & @CRLF)
EndFunc  ;==>trace

#Region ### START Koda GUI section ### Form=c:\program files\koda 1.7.01\forms\musicapp.kxf
$Form1_1 = GUICreate("Form1", 342, 250, 235, 182)
LOCAL $Tab1 = GUICtrlCreateTab(10, 9, 321, 233)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Flashanims' Music Searcher")
$Label1 = GUICtrlCreateLabel("Artist Name:", 24, 40, 61, 17)
$Input1 = GUICtrlCreateInput("", 24, 59, 161, 21)
GUICtrlSetState(-1, $GUI_FOCUS)
$Label2 = GUICtrlCreateLabel("Song Name:", 24, 83, 63, 17)
$Input2 = GUICtrlCreateInput("", 24, 102, 161, 21)
$Button1 = GUICtrlCreateButton("Search!", 24, 201, 73, 25, 0)
$Radio1 = GUICtrlCreateRadio("Optimized", 24, 124, 145, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio2 = GUICtrlCreateRadio("Filtered", 24, 143, 145, 25)
$Radio3 = GUICtrlCreateRadio("Un-filtered", 24, 163, 145, 25)
$TabSheet2 = GUICtrlCreateTabItem("Results")
GUICtrlCreateLabel("No search query.", 24, 40, 90, 17)
$oIE = _IECreateEmbedded()
$GUIActiveX = GUICtrlCreateObj($oIE, 20, 40, 300, 189)
GUISetState()
#EndRegion ### END Koda GUI section ###

_IENavigate($oIE, "http://www.coderkid.co.cc")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUISetState($TabSheet2, $GUI_FOCUS)
    EndSwitch
WEnd
Link to comment
Share on other sites

try changing

Case $Button1
            GUISetState($TabSheet2, $GUI_FOCUS)

to

Case $Button1
            GUISetState($TabSheet2, $GUI_SHOW)

Since I often don't use the constant I usually use

Case $Button1
            GUISetState($TabSheet2, 16)

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!"

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
 Share

  • Recently Browsing   0 members

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