Sign in to follow this  
Followers 0
YellowLab

Tabbing Inputboxes on Child Windows

5 posts in this topic

#1 ·  Posted (edited)

I have some child windows that I can't figure out how to be able to tab through the input boxes

Here is an example that works:

Global Const $GUI_DISABLE = 128
Global Const $GUI_EVENT_CLOSE = -3

Dim $InputDE[8]

;create main screen
$Main = GUICreate("Main", 400, 260, 200, 200,-1,-1)
GUISetBkColor(0xFFFFFF)
$InputDE[1] = GUICtrlCreateInput("MM/DD/YY", 280, 48, 113, 21)
$InputDE[2] = GUICtrlCreateInput("", 280, 72, 113, 21)
$InputDE[3] = GUICtrlCreateInput("", 280, 96, 113, 21)
$InputDE[4] = GUICtrlCreateInput("", 280, 120, 113, 21)
$InputDE[5] = GUICtrlCreateInput("", 280, 144, 113, 21)
$InputDE[6] = GUICtrlCreateInput("", 280, 168, 113, 21)
$InputDE[7] = GUICtrlCreateInput("", 280, 192, 113, 21)
$bEnterDE = GUICtrlCreateButton("Enter", 312, 224, 81, 25, 0)
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEndoÝ÷ ØúènW¦ËayÖ­iéí¯(¬¢v§¢Ø^® zj+zX¤zØb±«­¢+Ù±½°
½¹ÍÐÀÌØíU%}%M   1ôÄÈà)±½°
½¹ÍÐÀÌØíU%}Y9Q}
1=Mô´Ì)±½°
½¹ÍÐÀÌØí]M}
!%1ôÁàÐÀÀÀÀÀÀÀ()¥´ÀÌØí%¹ÁÕÑlát((íÉѵ¥¸Íɸ(ÀÌØí5¥¸ôU%
ÉÑ ÅÕ½Ðí5¥¸ÅÕ½Ðì°ÐÀÀ°ÈØÀ°ÈÀÀ°ÈÀÀ°´Ä°´Ä¤)U%MÑ  ­
½±½È Áá¤)U%MQMÑÑ ¤((ÀÌØí  ÕÑѽ¹ÌôU%
ÉÑ ÅÕ½Ðí ÕÑѽ¹ÌÅÕ½Ðì°ÐÀÀ°ÈØÀ°À°À°ÀÌØí]M}
!%1°´Ä°ÀÌØí5¥¸¤)U%MÑ    ­
½±½È Áá¤(ÀÌØíѹÑÉäôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½Ðí¹ÑÈÑÅÕ½Ðì°ÈÌÈ°Ðà°ÄÌÜ°ÌÌ°À¤)U%MÑMÑÑ ¤((ÀÌØíѹÑÉäôU%
ÉÑ ÅÕ½ÐíѹÑÉäÅÕ½Ðì°ÐÀÀ°ÈØÀ°À°À°ÀÌØí]M}
!%1°´Ä°ÀÌØí5¥¸¤)U%MÑ    ­
½±½È Áá¤(ÀÌØí%¹ÁÕÑlÅtôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½Ðí54½½edÅÕ½Ðì°ÈàÀ°Ðà°ÄÄÌ°ÈĤ(ÀÌØí%¹ÁÕÑlÉtôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÈàÀ°ÜÈ°ÄÄÌ°ÈĤ(ÀÌØí%¹ÁÕÑlÍtôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÈàÀ°äØ°ÄÄÌ°ÈĤ(ÀÌØí%¹ÁÕÑlÑtôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÈàÀ°ÄÈÀ°ÄÄÌ°ÈĤ(ÀÌØí%¹ÁÕÑlÕtôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÈàÀ°ÄÐаÄÄÌ°ÈĤ(ÀÌØí%¹ÁÕÑlÙtôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÈàÀ°ÄØà°ÄÄÌ°ÈĤ(ÀÌØí%¹ÁÕÑlÝtôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÈàÀ°ÄäÈ°ÄÄÌ°ÈĤ(ÀÌØí¹ÑÉôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½Ðí¹ÑÈÅÕ½Ðì°ÌÄÈ°ÈÈаàÄ°ÈÔ°À¤(ÀÌØí5¥¹ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½Ðí5¥¸ÅÕ½Ðì°ÈÀà°ÈÈаàÄ°ÈÔ°À¤)U%MÑMÑÑ¡M]}!%¤()]¡¥±Ä($ÀÌØí¹5ÍôU%Ñ5Í ¤(%MÝ¥Ñ ÀÌØí¹5Í($%
ÍÀÌØíU%}Y9Q}
1=M($$%á¥Ð($%
ÍÀÌØíѹÑÉä($$%U%MÑMÑÑ¡M]}!%°ÀÌØí ÕÑѽ¹Ì¤($$%U%MÑMÑÑ¡M]}M!=°ÀÌØíѹÑÉä¤($%
ÍÀÌØí5¥¸($$%U%MÑMÑÑ¡M]}M!=°ÀÌØí ÕÑѽ¹Ì¤($$%U%MÑMÑÑ¡M]}!%°ÀÌØíѹÑÉä¤(%¹MÝ¥Ñ )]¹

The child window is below the main window and tabbing doesn't go through the inputs. I have wracked my brain on different window styles trying to get this to work and have hit a wall. I have probably butchered how parent/child windows are supposed to work. Guidance on where to look to solve my issue would be appreciated. I have gone through window styles in the help and done some searches here on the forms but without success.

Thanks,

Bob

Edited by YellowLab

You can't see a rainbow without first experiencing the rain.

Share this post


Link to post
Share on other sites



I don't know why tabbing doesn't work in this case (parent-child) and I guess you're right about messing with these.

One question though: do you really need to use child windows? I wouldn't use them at all; this can be done with a simple GUI, no need for fancy things.

It is a longer code and not so "elegant" but it works.

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)

Dim $InputDE[8], $bMainDE, $bEnterDE
Dim $FirstRun = 1       ;flag for creating/showing the controls - =1 means controls will be created
;create main screen
$Main = GUICreate("Main", 400, 260, 200, 200,-1,-1)
GUISetOnEvent($GUI_EVENT_CLOSE, "XClose")
GUISetBkColor(0xFFFFFF)
$bDataEntry = GUICtrlCreateButton("Enter Data", 232, 48, 137, 33, 0)
GUICtrlSetOnEvent(-1, "Create_Inputboxes")
GUISETState()


While 1
    Sleep(200)
WEnd

Func Create_Inputboxes()
    If $FirstRun = 1 Then
        GUICtrlSetState($bDataEntry, $GUI_HIDE)
        $InputDE[1] = GUICtrlCreateInput("MM/DD/YY", 280, 48, 113, 21)
        $InputDE[2] = GUICtrlCreateInput("", 280, 72, 113, 21)
        $InputDE[3] = GUICtrlCreateInput("", 280, 96, 113, 21)
        $InputDE[4] = GUICtrlCreateInput("", 280, 120, 113, 21)
        $InputDE[5] = GUICtrlCreateInput("", 280, 144, 113, 21)
        $InputDE[6] = GUICtrlCreateInput("", 280, 168, 113, 21)
        $InputDE[7] = GUICtrlCreateInput("", 280, 192, 113, 21)
        $bEnterDE = GUICtrlCreateButton("Enter", 312, 224, 81, 25, 0)
        GUICtrlSetOnEvent(-1, "EnterData")
        $bMainDE = GUICtrlCreateButton("Main", 208, 224, 81, 25, 0)
        GUICtrlSetOnEvent(-1, "ShowMain")
        $FirstRun = 0       ;sets the value to 0 - from now on the controls will be only made visible
    Else
        GUICtrlSetState($bDataEntry, $GUI_HIDE)
        GUICtrlSetState($InputDE[1], $GUI_SHOW)
        GUICtrlSetState($InputDE[2], $GUI_SHOW)
        GUICtrlSetState($InputDE[3], $GUI_SHOW)
        GUICtrlSetState($InputDE[4], $GUI_SHOW)
        GUICtrlSetState($InputDE[5], $GUI_SHOW)
        GUICtrlSetState($InputDE[6], $GUI_SHOW)
        GUICtrlSetState($InputDE[7], $GUI_SHOW)
        GUICtrlSetState($bEnterDE, $GUI_SHOW)
        GUICtrlSetState($bMainDE, $GUI_SHOW)
    EndIf
EndFunc
Func XClose()
    Exit
EndFunc
Func EnterData()
    
EndFunc
Func ShowMain()     ;just to hide the controls
    GUICtrlSetState($bDataEntry, $GUI_SHOW)
    GUICtrlSetState($InputDE[1], $GUI_HIDE)
    GUICtrlSetState($InputDE[2], $GUI_HIDE)
    GUICtrlSetState($InputDE[3], $GUI_HIDE)
    GUICtrlSetState($InputDE[4], $GUI_HIDE)
    GUICtrlSetState($InputDE[5], $GUI_HIDE)
    GUICtrlSetState($InputDE[6], $GUI_HIDE)
    GUICtrlSetState($InputDE[7], $GUI_HIDE)
    GUICtrlSetState($bEnterDE, $GUI_HIDE)
    GUICtrlSetState($bMainDE, $GUI_HIDE)
EndFunc

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

Thanks enaiman.

Your solution does work and I will implement it into my project. I am still a little befuddled about the parent - child relationship and how these windows are most effectively used and would like to understand better. Any help in this area would be appreciated.

Bob


You can't see a rainbow without first experiencing the rain.

Share this post


Link to post
Share on other sites

This solution is "almost" as elegant as the OP:

Global Const $GUI_EVENT_CLOSE = -3
Global Const $GUI_SHOW = 16
Global Const $GUI_HIDE = 32

Dim $InputDE[8]

;create main screen
$Main = GUICreate("Main", 400, 260, 200, 200,-1,-1)
GUISetBkColor(0xFFFFFF)
;main buttons
$bDataEntry = GUICtrlCreateButton("Enter Data", 232, 48, 137, 33, 0)
;data entry
$InputDE[1] = GUICtrlCreateInput("MM/DD/YY", 280, 48, 113, 21)
$InputDE[2] = GUICtrlCreateInput("", 280, 72, 113, 21)
$InputDE[3] = GUICtrlCreateInput("", 280, 96, 113, 21)
$InputDE[4] = GUICtrlCreateInput("", 280, 120, 113, 21)
$InputDE[5] = GUICtrlCreateInput("", 280, 144, 113, 21)
$InputDE[6] = GUICtrlCreateInput("", 280, 168, 113, 21)
$InputDE[7] = GUICtrlCreateInput("", 280, 192, 113, 21)
$bEnterDE = GUICtrlCreateButton("Enter", 312, 224, 81, 25, 0)
$bMainDE = GUICtrlCreateButton("Main", 208, 224, 81, 25, 0)

_MyDataEntryToggle($GUI_HIDE)
GUISetState(@SW_SHOW,$Main)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $bDataEntry
            _MyMainButtonsToggle($GUI_HIDE)
            _MyDataEntryToggle()
        Case $bMainDE
            _MyDataEntryToggle($GUI_HIDE)
            _MyMainButtonsToggle()
    EndSwitch
WEnd

Func _MyDataEntryToggle($nState=$GUI_SHOW)
    For $nCount = 1 To 7
        GUICtrlSetState($InputDE[$nCount],$nState)
    Next
    GUICtrlSetState($bEnterDE,$nState)
    GUICtrlSetState($bMainDE,$nState)
EndFunc ;==>_MyDataEntryToggle

Func _MyMainButtonsToggle($nState=$GUI_SHOW)
    GUICtrlSetState($bDataEntry,$nState)
EndFunc ;==>_MyMainButtonsToggle

You can't see a rainbow without first experiencing the rain.

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