Keyboard Control
Posted
#1
(In Topic #1417)
Regular

Posted
Guru

pretty sure it's the default behavior for QT GUIs
Except the space bar is usually the press button key
Because usually you set 1 button in a window to have it's Button.Default = True and one other to have Button.Cancel = True
The button that has Cancel = True should click when pressing escape and the one that's Default click when pressing Enter/Return
or maybe something like this…
Code (gambas)
- ' If using gb.gui and maybe GTK+ then we operate manually or if QT then skip doing anything and let the toolkit function as normal.
Posted
Regular

Problems occur when there are containers that can gain focus or there are read-only or hidden controls in the way. Also Bruce's suggestion depends on the tab order of the controls (and wont wrap around if you want that.)
I would use explicit SetFocus calls and specific event handlers for each button. Like:
b
Posted
Regular

Thanks Bruce! That will get me started. I feel like I should be paying you for all the times you've helped meBruceSteers said
Just make your application use QT. (gb.gui.qt)
pretty sure it's the default behavior for QT GUIs
Except the space bar is usually the press button key
Because usually you set 1 button in a window to have it's Button.Default = True and one other to have Button.Cancel = True
The button that has Cancel = True should click when pressing escape and the one that's Default click when pressing Enter/Return
or maybe something like this…Code (gambas)
' If using gb.gui and maybe GTK+ then we operate manually or if QT then skip doing anything and let the toolkit function as normal.
Posted
Regular

thatbruce said
Even with QT this can sometimes be incorrect.
Problems occur when there are containers that can gain focus or there are read-only or hidden controls in the way. Also Bruce's suggestion depends on the tab order of the controls (and wont wrap around if you want that.)
I would use explicit SetFocus calls and specific event handlers for each button. Like:b
Thanks Other Bruce! That looks super simple and I'll give that a try tomorrow. Thanks to both Bruces again!
Posted
Guru

There is a command line tool that will click the mouse called xdotool (X11 only) that I have used and will need to be installed for this to work!
While testing I found the space bar clicks buttons even if the mouse is nowhere near, so I have used [F12]!
The advantage I see in this code is simplification.
Code (gambas)
Here is the program
Posted
Regular

cogier said
This may, or may not, interest you, but it was interesting trying to get it all to work.
There is a command line tool that will click the mouse called xdotool (X11 only) that I have used and will need to be installed for this to work!
While testing I found the space bar clicks buttons even if the mouse is nowhere near, so I have used [F12]!
The advantage I see in this code is simplification.Code (gambas)
Here is the program
Test-0.1.tar.gz
Thanks cogier. I'm familiar with xdotool and what you have done looks really interesting. What both Bruces gave me was enough to get me pointed in the right direction. This app I'm working is turning out to be really cool and fun to work on.
1 guest and 0 members have just viewed this.


