Jump to content

[Solved]Multiple Input control help


Zacam
 Share

Recommended Posts

To further clarify:

I have a section in my GUI, where a serial key is to be input for passing to another application as part of a system setup tool.

Since the vendor serial is sort of long and broken up into groups, they want the input to go into groups as well.

(Ease of read-back and verification)

I have that working just fine but the complaint is, once one group is filled in, you have to tab to go to the next group.

They would like to have the typing position set to the next group once the preceding group is filled in.

In searching (here and through the Scite and Koda Help), I do not find anything regarding how to accomplish this.

It is entirely possible that my search terminology may be wrong.

Is such a thing already documented? And if it is not, does anyone have any thoughts on how to accomplish this task?

Thanks in advance.

Edited by Zacam
Link to comment
Share on other sites

That would, I am guessing, require using a MsgBox to take the input and split across the Inputs that are in the GUI.

Which I had already contemplated and may resort to.

I am more looking to see if I have: Input1, Input2, Input3 and they are set to 10 max characters, once Character#10 is typed into Input1, the text input control moves over to Input2 for the next 10 characters.

But thank you for the quickness of your response. I perhaps should have also qualified which other methods I had already contemplated, and why I did not select using them over what I am looking to accomplish.

The end product will end up being deployed in to areas where the individuals operating the system are not exactly the most tech savvy. But we need a unified way of being able to handle the system configuration.

MS (and various other InstallShield etc softwares) has unfortunately set a precedent where in the above example, the requested behaviour occurs. I am trying to mimic that same behaviour.

Edited by Zacam
Link to comment
Share on other sites

I already have the GUI. I already have the inputs. Everything is already working.

I am looking to have, while the input fields are being filled out, having it auto progress to the next field without having to hit TAB to shift to the next input field.

Link to comment
Share on other sites

I already have the GUI. I already have the inputs. Everything is already working.

I am looking to have, while the input fields are being filled out, having it auto progress to the next field without having to hit TAB to shift to the next input field.

How can I help if I can't see what I am working on.... I work with code only!

Good Luck... bye

8)

NEWHeader1.png

Link to comment
Share on other sites

Then create a GUI with 3 input boxes limited to 10 characters a piece. Type in them and realize that you have to hit TAB to progress through them, instead of the input handler progressing to the next input box.

This does not require having to have any code to figure out. But okay, code you want, code thou shalt have:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form3 = GUICreate("Form3", 383, 61, 346, 352)
GUISetFont(8, 400, 0, "Courier New")
GUISetBkColor(0xFFFBF0)
$Input1 = GUICtrlCreateInput("", 5, 20, 120, 22)
GUICtrlSetLimit(-1, 10)
$Input2 = GUICtrlCreateInput("", 130, 20, 120, 22)
GUICtrlSetLimit(-1, 10)
$Input3 = GUICtrlCreateInput("", 255, 20, 120, 22)
GUICtrlSetLimit(-1, 10)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Link to comment
Share on other sites

This is one way

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $Input[4], $Count = 1

#Region ### START Koda GUI section ### Form=
$Form3 = GUICreate("Form3", 383, 61, 346, 352)
GUISetFont(8, 400, 0, "Courier New")
GUISetBkColor(0xFFFBF0)
$Input[1] = GUICtrlCreateInput("", 5, 20, 120, 22)
GUICtrlSetLimit(-1, 10)
$Input[2] = GUICtrlCreateInput("", 130, 20, 120, 22)
GUICtrlSetLimit(-1, 10)
$Input[3] = GUICtrlCreateInput("", 255, 20, 120, 22)
GUICtrlSetLimit(-1, 10)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()

    If StringLen(GUICtrlRead($Input[$Count])) = 10 And $Count > 0 Then
        Send("{TAB}")
        $Count += 1
        If $Count = 3 Then $Count = 0 ; done
    EndIf

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

8)

NEWHeader1.png

Link to comment
Share on other sites

Here, there is probably a better way but I gotta go out with the dog now xD

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form3 = GUICreate("Form3", 383, 61, 346, 352)
GUISetFont(8, 400, 0, "Courier New")
GUISetBkColor(0xFFFBF0)
Local $serial[3]= [GUICtrlCreateInput("", 5, 20, 120, 22), _
                  GUICtrlCreateInput("", 130, 20, 120, 22), _
                  GUICtrlCreateInput("", 255, 20, 120, 22)]
                  GUICtrlSetLimit($serial[0], 10)
                  GUICtrlSetLimit($serial[1], 10)
                  GUICtrlSetLimit($serial[2], 10)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$i=0
While 1
    Sleep(30)
    If StringLen(GUICtrlRead($serial[$i])) >=10 And $i<>2 Then
        GUICtrlSetState($serial[$i+1],$GUI_FOCUS)
    $i+=1
    EndIf
    
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Edit; DAMN YOU VALUATER :D

Edited by Zisly
Link to comment
Share on other sites

Both of your examples work perfectly, thank you very much.

I do apologize for my abruptness in my last post, I would have thought being able to visualize a behaviour to understand it would have been sufficient.

Again, thank you.

Edit: How then do I do a GUICtrlRead from the data input? Or do I not need to change anything?

Edited by Zacam
Link to comment
Share on other sites

So basically, just add the [1], [2]..etc to my existing GUICtrlRead's then. Thought as much.

Again, thank you. Next time, even if I think the concept should be understandable, I will post code forthwith.

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