Jump to content

Tabbing within child GUI


bratton
 Share

Recommended Posts

Hello,

I'm trying to use the following code to create a child gui, but when the child gui opens, I can't tab from one field to the next. If I change the code so that the child gui opens in a separate gui, tabbing works fine. Is there a better way for me to write this so that the child does not have to open in a separate gui and tabbing still works? I'm sure this is answered somewhere, but I just couldn't find it. If someone could point me in the right direction, I would greatly appreciate it.

Thanks in advance for the help.

CODE
#include <GUIConstants.au3>

$Main_GUI = GuiCreate("This is my GUI", 460, 300)

GUISetState()

$parent = GuiCreate('parent', 460, 300, 0, 0, $WS_CHILD,-1, $Main_GUI)

$lbl = GUICtrlCreateLabel ("Main Gui.", 10, 15, 450,100)

$btn1 = GUICtrlCreateButton ("child", 20, 120, 100, 40)

$child1 = GuiCreate('child1', 460, 300,0,0, $WS_CHILD,-1, $Main_GUI)

$childlbl = GUICtrlCreateLabel ("Child Gui.", 10, 15, 450,100)

GUICtrlCreateLabel ("field1", 30, 110)

$field = GUICtrlCreateInput ("",110, 105, 130, 20)

GUICtrlCreateLabel ("field2", 30, 135)

$field1 = GUICtrlCreateInput ("",110, 130, 130, 20)

$submit = GUICtrlCreateButton ("Submit", 30, 235, 70, 30)

$cancel = GUICtrlCreateButton ("Cancel", 120, 235, 70, 30)

GUISetState(@SW_SHOW, $parent)

GUISetState(@SW_HIDE, $child1)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $btn1

GUISetState(@SW_SHOW, $child1)

GUISetState(@SW_HIDE, $parent)

Case $msg = $cancel

GUISetState(@SW_SHOW, $parent)

GUISetState(@SW_HIDE, $child1)

Case $msg = $GUI_EVENT_CLOSE

Exit

EndSelect

WEnd

Edited by bratton
Link to comment
Share on other sites

Quite funny,

I logged in to the forums to ask exactly the same question!

I have a childwindow with a few inputboxes on them, but don't know how to tab between them. I tried the Tabstop parameter as refered to in the help file, but it doesn't work.

Link to comment
Share on other sites

This might do the trick... from kick???joe

#include <GUIConstants.au3>
Dim $TabSwitcher[2]

GUICreate("Test")

$TabSwitcher[0] = GUICtrlCreatePic("C:\temp\button1.jpg", 10, 10,20,20)

$TabSwitcher[1] = GUICtrlCreatePic("C:\temp\button1.jpg", 70, 10,20,20)

$tab = GUICtrlCreateTab(10,40, 200, 200);can be placed anywhere, doesnt matter, not visible

$tab1 = GUICtrlCreateTabItem("tab1")
GUICtrlCreateButton("button on tab 1", 10, 70)
GUICtrlCreateInput("", 20, 150, 100, 20)
GUICtrlCreateInput("", 20, 175, 100, 20)
GUICtrlCreateInput("", 20, 200, 100, 20)


$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlCreateButton("button on tab 2", 10, 70)
GUICtrlCreateInput("", 20, 150, 100, 20)
GUICtrlCreateInput("", 20, 175, 100, 20)
GUICtrlCreateInput("", 20, 200, 100, 20)

GUICtrlSetState($tab, $GUI_HIDE)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $TabSwitcher[0]
            If GUICtrlRead($tab) <> 0 Then GUICtrlSetState($tab1, $GUI_SHOW)
        Case $msg = $TabSwitcher[1]
            If GUICtrlRead($tab) <> 1 Then GUICtrlSetState($tab2, $GUI_SHOW)
        Case $msg = -3
            Exit
        Case Else
            
    EndSelect
WEnd

8)

NEWHeader1.png

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