PDA

View Full Version : UI text input and "focus"



TheOne
14-03-2011, 14:36
Hi,

I was playing around with the textbox script example. I sort of figure out what was happening in this script. So I modified it to include 2 text input instead of one. Have the magicbutton (OK) display and clickable. (Kind of practicing so that later I can modify my console like data entry to a UI data entry program).

What I couldn't figure out was how to:

1. After you input data in textbox 1 and allow TAB to go to the next textbox. With the sample textbox script, if I hit TAB, it would go from textbox1 to OK button to textbox2.

2. How to use either TAB or RETURN key to go to next textbox. And then allow only the OK (magicbutton) to do something (in my case, to write output to a file which I now know how to do.)

Thanks for any suggestions.

Michael Clease
14-03-2011, 22:56
%WS_GROUP
Define the start of a group of controls.
The first control in each group should also use %WS_TABSTOP style.
The next %WS_GROUP control in the tab order defines the end of this group
and the start of a new group.

%WS_TABSTOP
Allow the textbox control to receive keyboard focus when the user presses
the TAB and SHIFT+TAB keys.
The TAB key shifts keyboard focus to the next control with the %WS_TABSTOP style
and SHIFT+TAB shifts focus to the previous control with %WS_TABSTOP. (default)





Control Add Textbox , hDlg, %TxbCustom, "", 90, 30, 270, 14, %SS_CENTER Or %SS_CENTERIMAGE Or %WS_GROUP Or %WS_TABSTOP
Control Add Textbox , hDlg, %TxbSerial, "", 90, 60, 270, 14, %SS_CENTER Or %SS_CENTERIMAGE Or %WS_TABSTOP
Control Add Textbox , hDlg, %TxbDate , "", 90, 90, 270, 14, %SS_CENTER Or %SS_CENTERIMAGE Or %WS_GROUP Or %WS_TABSTOP


So start the group then add a tabstop to each control, it will then follow the order you place the controls until it reaches another group or you stop adding controls....simples...

as for the enter tab thing look at msdn and keydown events.

TheOne
15-03-2011, 19:58
Thanks Michael.

I will try it and do some more reading.