Results 1 to 3 of 3

Thread: UI text input and "focus"

  1. #1

    UI text input and "focus"

    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.

  2. #2
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    159

    Simples....

    %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.
    Last edited by Michael Clease; 14-03-2011 at 23:02.
    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  3. #3
    Thanks Michael.

    I will try it and do some more reading.

Similar Threads

  1. Uses "File", "Crypto" ... ???
    By marcuslee in forum thinBasic General
    Replies: 3
    Last Post: 01-12-2009, 19:38

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •