Sign in to follow this  
Followers 0
iceberg

Auto Tab

8 posts in this topic

Hi,

Let's say I have created a custom GUI. In it I have 2 Input boxes...A and B.

Both input boxes can only contain 2 digits. (this part i am able to handle)

But what I wish to learn is how do I make it such that once Input box A has fulfilled the criteria for the input, how can it auto tab or "jump" to Input Box B?

Thanks alot. Pls help.


mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

Let's say I have created a custom GUI. In it I have 2 Input boxes...A and B.

Both input boxes can only contain 2 digits. (this part i am able to handle)

But what I wish to learn is how do I make it such that once Input box A has fulfilled the criteria for the input, how can it auto tab or "jump" to Input Box B?

Thanks alot. Pls help.

Not quite sure, but I think ControlFocus ( "title", "text", controlID ) may be what you're looking for?

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

nope, doesn't work.

thanks.


mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites

try GuiCtrlSetState with $GUI_FOCUS and there is no Auto Tab so you'll have to determine when to use the GuiCtrlSetState.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Here's one method of accomplishing this.

#include <GuiConstants.au3>

Global Const $WM_COMMAND = 0x0111
Global Const $EN_CHANGE = 0x300
Global Const $DebugIt = 1

GUICreate(" My GUI input acceptfile", 320, 120)
$input1 = GUICtrlCreateInput("", 10, 5, 300, 20, $ES_NUMBER)
GUICtrlSetLimit($input1, 2)
$input2 = GUICtrlCreateInput("", 10, 35, 300, 20, $ES_NUMBER)
GUICtrlSetLimit($input2, 2)
$btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20)

GUISetState()
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    Select
        Case $msg = $btn
            ExitLoop
    EndSelect
WEnd

Func _Input1_Changed()
    ;----------------------------------------------------------------------------------------------
    If $DebugIt Then _DebugPrint("Input Changed:" & GUICtrlRead($input1))
    ;----------------------------------------------------------------------------------------------
    If StringLen(GUICtrlRead($input1)) = 2 Then GUICtrlSetState($input2, $GUI_FOCUS)
EndFunc   ;==>_Input1_Changed

Func _Input2_Changed()
    ;----------------------------------------------------------------------------------------------
    If $DebugIt Then _DebugPrint("File Changed:" & GUICtrlRead($input2))
    ;----------------------------------------------------------------------------------------------
EndFunc   ;==>_Input2_Changed

Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift ($wParam, 16)
    Local $nID = BitAND($wParam, 0xFFFF)
    Local $hCtrl = $lParam

    Switch $nID
        Case $input1
            Switch $nNotifyCode
                Case $EN_CHANGE
                    _Input1_Changed()
            EndSwitch
        Case $input2
            Switch $nNotifyCode
                Case $EN_CHANGE
                    _Input2_Changed()
            EndSwitch
    EndSwitch
    ; Proceed the default Autoit3 internal message commands.
    ; You also can complete let the line out.
    ; !!! But only 'Return' (without any value) will not proceed
    ; the default Autoit3-message in the future !!!
    Return $GUI_RUNDEFMSG
EndFunc   ;==>MY_WM_COMMAND

Func _DebugPrint($s_text)
    $s_text = StringReplace($s_text, @LF, @LF & "-->")
    ConsoleWrite("!===========================================================" & @LF & _
            "+===========================================================" & @LF & _
            "-->" & $s_text & @LF & _
            "+===========================================================" & @LF)
EndFunc   ;==>_DebugPrint
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

thaks gafrost....but got a little error

Line 40 (File "Test.au3")

Local $nNotifyCode = _HiWord ($wParam)

Local $nNotifyCode = ^ ERROR

Error: Unknown function name.

Edited by iceberg

mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites

thaks gafrost....but got a little error

Line 40 (File "Test.au3")

Local $nNotifyCode = _HiWord ($wParam)

Local $nNotifyCode = ^ ERROR

Error: Unknown function name.

copy and paste error on my part, fixed the above post


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

thanks alot.

i works magically now...


mouse not found....scroll any mouse to continue.

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