noob questions: keyboard access to buttons
[1/4] from: dougedmunds::gmail at: 20-Apr-2008 8:53
Hello,
Assume I have this window (running on Windows XP)
view layout [myfield1: field "data1" myfield2: field "data2" button "Do
something" [dosomething] button "Quit" [quit]]
I want to create keyboard access, so the user does not have to use a mouse.
Is there a way to get focus to the buttons, so hitting 'enter' on the
keyboard will activate a button?
Is there a way to add the buttons to the tabbing order?
Is there someway to code "Alt-Q" for Quit, with an underscored 'Q'?
--Doug Edmunds
[2/4] from: gregg::pointillistic::com at: 20-Apr-2008 13:37
Hi Doug,
D> Assume I have this window (running on Windows XP)
D> view layout [myfield1: field "data1" myfield2: field "data2" button "Do
D> something" [dosomething] button "Quit" [quit]]
D> I want to create keyboard access, so the user does not have to use a mouse.
D> Is there a way to get focus to the buttons, so hitting 'enter' on the
D> keyboard will activate a button?
D> Is there a way to add the buttons to the tabbing order?
No. Lack of a complete focus system, and keyboard support, is one of
the biggest holes in VID. If you want to do this, you'll have to do a
lot of work yourself. I'm not sure how RebGUI is on this count, but it
might be better. Maybe a RebGUI user will respond.
D> Is there someway to code "Alt-Q" for Quit, with an underscored 'Q'?
It doesn't display hot-keys as underlined letters, and the ctrl key is
used more commonly in REBOL, as it would be for a shortcut key on a
menu. You can use the KEY style to catch keystrokes as well.
view layout [
button "Quit" #"^q" [unview] ; ctr;+q triggers button action
key #"^s" [alert "saving data"]
]
-- Gregg
[3/4] from: Izkata::Comcast::net at: 21-Apr-2008 3:01
On Sun, 2008-04-20 at 13:37 -0600, Gregg Irwin wrote:
> Hi Doug,
> D> Assume I have this window (running on Windows XP)
<<quoted lines omitted: 8>>
> lot of work yourself. I'm not sure how RebGUI is on this count, but it
> might be better. Maybe a RebGUI user will respond.
Well, there's sort of a way to fake the "hitting enter" thing in VID:
view layout [
myfield1: field "data1"
myfield2: field "data2" [MyButton/action MyButton MyButton/text]
MyButton: button "Do something" [dosomething]
button "Quit" [quit]
]
Hitting Enter on the first field automatically moves to the next, and
hitting enter again would move back to the beginning of the list of
fields. The action associated with the second field gets triggered when
it loses focus.
The problem is that field actions get triggered *any* time the focus
leaves the field - so if the user clicks somewhere, or tries to tab out
of it, the action will still happen.
[4/4] from: anton::wilddsl::net::au at: 23-Apr-2008 1:04
Hi Doug,
Yes, you have to patch the default system a bit,
as I have done here:
do http://anton.wildit.net.au/rebol/gui/demo-button.r
additional required files
http://anton.wildit.net.au/rebol/gui/button.r
http://anton.wildit.net.au/rebol/patch/focus-system-patch.r
The focus-system-patch.r implements a tabbing system which
recurses into and out of subfaces, so you should be able
to tab to any tab-focusable style in your window.
I also have other VID styles which respond to tabbing.
I haven't mucked with tab-order much myself, but the builtin
ctx-text/edit-text checks each face for a refocus function
which might be able to be used to reroute the focus to a
specific face. I'm not sure if that works with my system,
actually, so let me know if you really need it.
Let me know if something doesn't work at your end.
Regards,
Anton.
DougEdmunds wrote:
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted