tab stop order

Post

Posted
Rating:
#1 (In Topic #1575)
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’
I know how to set the order of tab stops using the hierarchy option. however it does not seem to work on anything other than text fields. I have a membership program and you can hit the tab to move field to field however there are radio buttons and combo boxes and checkboxes and none of them accept the tab stop. Is there a way to make this happen so I can let a client tab from a text field into the next thing such as a combo box or checkbox then tab to the next field such as another textbox? At the moment the tab does not put them on those other items and if on the item such as a checkbox, hitting tab does nothing at all to get them to the next entry field.
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
you'll find it depends on the toolkit.

QT behaves differently to GTK
The only sure fire way to get it to work exactly how you want is to use "Stop Event" in the key event and do it yourself.

Code (gambas)

  1.  
  2. Public Sub Form_Keypress()
  3.  
  4.   If Key.Code = Key["Tab"] Then
  5.     Stop Event  ' stop the toolkit doing it's own thing then do it yourself...
  6.     If Key.Shift Then
  7.       Me.ActiveControl.Previous.SetFocus
  8.     Else
  9.       Me.ActiveControl.Next.SetFocus
  10.     Endif
  11.  
  12.  
  13.  

Note: that code probably won't work because the ActiveControl.Next might be a label or a panel so you'll have to improve it to find the next control.
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Administrator
sholzy is in the usergroup ‘unknown’
 Tab stops work on QT, at least up to Gambas 3.18.0 (don't know if a change after that). The only exception is radio buttons, which will tab to the first one, then you need to use the arrows keys to move between the radio buttons.

sholzy
Gambas One Site Director

To report bugs in the Gambas IDE:
Official Gambas Bug Tracker
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Regular
thatbruce is in the usergroup ‘Regular’

BruceSteers said

Note: that code probably won't work because the ActiveControl.Next might be a label or a panel so you'll have to improve it to find the next control.

So true!!! I have yet to discover a satisfactory general solution to this.
b

Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’

BruceSteers said

you'll find it depends on the toolkit.

QT behaves differently to GTK
The only sure fire way to get it to work exactly how you want is to use "Stop Event" in the key event and do it yourself.

Code (gambas)

  1.  
  2. Public Sub Form_Keypress()
  3.  
  4.   If Key.Code = Key["Tab"] Then
  5.     Stop Event  ' stop the toolkit doing it's own thing then do it yourself...
  6.     If Key.Shift Then
  7.       Me.ActiveControl.Previous.SetFocus
  8.     Else
  9.       Me.ActiveControl.Next.SetFocus
  10.     Endif
  11.  
  12.  
  13.  

Note: that code probably won't work because the ActiveControl.Next might be a label or a panel so you'll have to improve it to find the next control.

you are correct, that did not work. but it pointed me in the right direction. I am doing it in the individual control keyrelease event. It works except when I try to jump to a combobox. then it does nothing. I have several combo boxes I need to hit this way so if you have ideas on that it would help.   Also the me.activecontol should be application.activecontrol I believe although as I said I am doing it in the controls adjacent to the problem ones. works for the check boxes but not comboboxes.
Online now: No Back to the top
1 guest and 0 members have just viewed this.