Auto-Tab to next text box after input

Archived support forum for customers who once purchased a PrimalForms product license. This forum is locked.
This topic is 11 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
graves
Posts: 8
Last visit: Thu Oct 08, 2015 8:48 am

Auto-Tab to next text box after input

Post by graves »

Hello,

I want to build a small form used to collect three barcodes from a handheld scanner to three separate fields. Is there any way to auto-tab to the next field after scanning a barcode so the user doesn't have to manually tab to the next field before scanning again? In the mean time I designed it so that all the data is scanned into a rich text box in a specific order, the data get's stored to a variable and split by `n`r where a for loop counts through every three strings and creates a log file with the data. However, I'm just not happy with this from a end user perspective as three separate labeled fields would be more intuitive.

Thanks
User avatar
Alexander Riedel
Posts: 8473
Last visit: Tue Mar 19, 2024 1:15 am
Answers: 19
Been upvoted: 37 times

Auto-Tab to next text box after input

Post by Alexander Riedel »

Use the .Focus() member of whatever control object you want to have the input focus after processing the change event from the previous input.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
graves
Posts: 8
Last visit: Thu Oct 08, 2015 8:48 am

Auto-Tab to next text box after input

Post by graves »

Thanks, Alexander! Works perfectly.

$txtBoxA
$txtBoxB

$handler_txtBoxA_TextChanged=
{
if ($txtBoxA.Text.Length -ge 7)
{
$txtBoxB.Focus()
}
}
User avatar
graves
Posts: 8
Last visit: Thu Oct 08, 2015 8:48 am

Auto-Tab to next text box after input

Post by graves »

One question though - what if I don't know the length of the field? The problem I'm running up against is obviously if $txtBoxA.Text.Length is greater than 7, the cursor is jumping to the next field after 7 characters are entered.

This field is used to collect hard drive serial numbers and the length varies quite often amongst different manufacturers and models.

Any suggestions?

Thanks in advance.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Auto-Tab to next text box after input

Post by davidc »

If the length is unknown they you should not change the focus on the control and let the user decide.

I recommend setting the tab order of the controls, so when the user presses the 'Tab' key, it will jump to the next field. The tab order button is located:

Ribbon->Home->Designer

Once you press the tab order button, simply click on the controls and it will set the tab index in the order of your clicks.

David
David
SAPIEN Technologies, Inc.
User avatar
graves
Posts: 8
Last visit: Thu Oct 08, 2015 8:48 am

Auto-Tab to next text box after input

Post by graves »

Thanks for your reply but the only problem with that is the user may or may not be near a keyboard as they are using a wireless handheld scanner and are often not near the workstation.

I really hope I don't have to abandon this layout for my previous one.

Thanks,
Jason
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Auto-Tab to next text box after input

Post by davidc »

So the user isn't typing the value in? Can't you just focus the control after inserting the value? I guess I'm not clear on what is happening here.

David
David
SAPIEN Technologies, Inc.
User avatar
graves
Posts: 8
Last visit: Thu Oct 08, 2015 8:48 am

Auto-Tab to next text box after input

Post by graves »

Seems I might be missing something very basic here. I would like to simply focus the control after the user scans the data but I don't know how without using a TextChanged event on the control and if the length of the string is not consistent then TextChanged does me no good.

The process should go like:

-user scans data to field 1.
-focus automatically changes to field 2.
-user scans data to field 2
-focus changes to field 3
-user scans data to field 3
-the submit button automatically is pressed (will probably hide the submit button control)
-data from all three fields is stored to separate variables and a log is created with the data
-all fields are cleared and focus is reset to field 1.

I have this all working using TextChanged but not without a huge drawback of not always knowing the string length.

Thanks,
Jason
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Auto-Tab to next text box after input

Post by davidc »

You don't have to use the TextChanged event if your script is inserting the text. It is hard to tell what you are doing without looking at the script.

This really is going beyond the scope of this product forum. I recommend posting the question in the Windows PowerShell forum and include a sample form.

David
David
SAPIEN Technologies, Inc.
This topic is 11 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.