Jump to content

Recommended Posts

Posted

Hello all,

I'm using Input fields, limited to x characters (4 in example below). I was wondering if it would be possible to jump directly to the next field once the required number of characters entered.

Here's my example of the input fields:

*********************************************************

GUICreate("Saisie", 345,90)

$champ1s = GUICtrlCreateInput ( "", 10, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

GUICtrlSetState (-1, $GUI_FOCUS)

$champ2s = GUICtrlCreateInput ( "", 65, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

$champ3s = GUICtrlCreateInput ( "", 120, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

$champ4s = GUICtrlCreateInput ( "", 175, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

$champ5s = GUICtrlCreateInput ( "", 230, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

$champ6s = GUICtrlCreateInput ( "", 285, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

GUICtrlCreateLabel ("Merci de saisir votre n°", 55, 30, 250)

GUICtrlCreateLabel ("Confirmez ensuite par OK.", 105, 45, 200)

$ok = GUICtrlCreateButton ("Ok", 130, 65, 60, 20)

GUISetState ()

$msg = 0

While $msg <> $GUI_EVENT_CLOSE

$msg = GUIGetMsg()

Select

Case $msg = $ok

exitloop

EndSelect

Wend

*********************************************************

Posted

I'm not all that good in coding, but you may want to have it so when each field is typed in, it is tied to a case statement. The case statement would do a string read, and if the limit is reached, it would tell it to go to the next field. I hope I'm making sence here. (If not, may I be kindly corrected by the AutoIt gods of wisdom...)

Posted (edited)

Hello all,

I'm using Input fields, limited to x characters (4 in example below). I was wondering if it would be possible to jump directly to the next field once the required number of characters entered.

Here's my example of the input fields:

*********************************************************

GUICreate("Saisie", 345,90)

$champ1s = GUICtrlCreateInput ( "", 10, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

GUICtrlSetState (-1, $GUI_FOCUS)

$champ2s = GUICtrlCreateInput ( "", 65, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

$champ3s = GUICtrlCreateInput ( "", 120, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

$champ4s = GUICtrlCreateInput ( "", 175, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

$champ5s = GUICtrlCreateInput ( "", 230, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

$champ6s = GUICtrlCreateInput ( "", 285, 5, 50, 20)

GUICtrlSetLimit (-1, 4 )

GUICtrlCreateLabel ("Merci de saisir votre n°", 55, 30, 250)

GUICtrlCreateLabel ("Confirmez ensuite par OK.", 105, 45, 200)

$ok = GUICtrlCreateButton ("Ok", 130, 65, 60, 20)

GUISetState ()

$msg = 0

While $msg <> $GUI_EVENT_CLOSE

$msg = GUIGetMsg()

Select

Case $msg = $ok

exitloop

EndSelect

Wend

*********************************************************

I have seen an example of what you want somewhere on the forums but I cant find it now. I think that GaFrost used something similar for IP addresses on the AutiIt-ITS project at one time. It may be worth giving him a PM or wait hoping that he sees this.

Edit

You are in luck I have found a copy of the sample on my computer.

#include <GUIConstants.au3>
#include <GUIEdit.au3>

GuiCreate("Enter Registration Code",300,50,@DesktopWidth/2-150,@DesktopHeight/2-25)
$i1 = GuiCtrlCreateInput("",10,15,50,20)
GuiCtrlSetLimit($i1,5)
$i2 = GuiCtrlCreateInput("",70,15,50,20)
GuiCtrlSetLimit($i2,5)
$i3 = GuiCtrlCreateInput("",130,15,50,20)
GuiCtrlSetLimit($i3,5)
$b1 = GuiCtrlCreateButton("Next >",190,15,50,20)
$b2 = GuiCtrlCreateButton("Exit",250,15,40,20)
GuiSetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $b2
        ExitLoop
    Case $msg = $b1
        MsgBox(0,"Next","This button gets the focus when the last input box is filled.")
    EndSelect
    If _GUICtrlEditLineLength($i1) = 5 and _GUICtrlEditGetModify($i1) > 0 Then
        GuiCtrlSetState($i2,$GUI_FOCUS)
        _GUICtrlEditSetModify($i1,false)
    EndIf
    If _GUICtrlEditLineLength($i2) = 5 and _GUICtrlEditGetModify($i2) > 0 Then
        GuiCtrlSetState($i3,$GUI_FOCUS)
        _GUICtrlEditSetModify($i2,false)
    EndIf
    If _GUICtrlEditLineLength($i3) = 5 and _GUICtrlEditGetModify($i3) > 0 Then
        GuiCtrlSetState($b1,$GUI_FOCUS)
        _GUICtrlEditSetModify($i3,false)
    EndIf
WEnd

I have no idea who wrote it but if they come forward they are welcome to the credit.

Edited by BigDod


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

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
×
×
  • Create New...