Dialog box selections using keyboard.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Dialog box selections using keyboard.
Hi,
Is there a (reasonably easy) way to let the user use the keyboard, arrows or tab, to move to another option in the dialog box?
Is there a (reasonably easy) way to let the user use the keyboard, arrows or tab, to move to another option in the dialog box?
-
- Livecode Opensource Backer
- Posts: 10096
- Joined: Fri Feb 19, 2010 10:17 am
Re: Dialog box selections using keyboard.
Can't see you managing that with this:
-
-
Re: Dialog box selections using keyboard.
Hi,
Thanks for that, you probably saved me a lot of time trying; good to get your experienced opinion.
Thanks for that, you probably saved me a lot of time trying; good to get your experienced opinion.
Re: Dialog box selections using keyboard.
CAsba
Dialog boxes like "Ask" and "Answer" block all but a very few actions, particular to each. Clicking one of the presented buttons (or using "Enter" or "Return" to select the default), along with the ability to enter text in an "ask" dialog is all she wrote.
Craig
Dialog boxes like "Ask" and "Answer" block all but a very few actions, particular to each. Clicking one of the presented buttons (or using "Enter" or "Return" to select the default), along with the ability to enter text in an "ask" dialog is all she wrote.
Craig
-
- Livecode Opensource Backer
- Posts: 10096
- Joined: Fri Feb 19, 2010 10:17 am
Re: Dialog box selections using keyboard.
It's a mouse-driven age.

-
- Livecode Opensource Backer
- Posts: 10096
- Joined: Fri Feb 19, 2010 10:17 am
Re: Dialog box selections using keyboard.
Let's have slightly dubious fun setting up a substack as a dialog thingy:
- -
set the traversalOn of ALL the buttons to true.
- -
set the traversalOn of ALL the buttons to true.
-
- Livecode Opensource Backer
- Posts: 10096
- Joined: Fri Feb 19, 2010 10:17 am
Re: Dialog box selections using keyboard.
Here's a fake dialog palette:
- -
You can use the RIGHT ARROW key to change the selected button.
You can use the ENTER (not the 'Return' key) to activate the selected button.
The reason I change the button text to red is because LiveCode gives NO visual cue (bad) when a button
receives focus.
- -
You can use the RIGHT ARROW key to change the selected button.
You can use the ENTER (not the 'Return' key) to activate the selected button.
Code: Select all
on openStack
focus on btn "B1"
set the textColor of btn "B1" to red
end openStack
on enterKey
send "mouseUp" to the focusedObject
end enterKey
on arrowKey AK
if AK = "right" then
if the textColor of btn "B3" is red then
focus on btn "B1"
set the textColor of btn "B3" to black
set the textColor of btn "B1" to red
end if
if the textColor of btn "B2" is red then
focus on btn "B3"
set the textColor of btn "B2" to black
set the textColor of btn "B3" to red
end if
if the textColor of btn "B1" is red then
focus on btn "B2"
set the textColor of btn "B1" to black
set the textColor of btn "B2" to red
end if
end if
end arrowKey
on closeStack
set the textColor of btn "B1" to black
set the textColor of btn "B2" to black
set the textColor of btn "B3" to black
end closeStack
receives focus.
- Attachments
-
- KB - DIALOGUE.livecode.zip
- Stack.
- (1.25 KiB) Downloaded 108 times
Re: Dialog box selections using keyboard.
It's a system setting. As long as all controls have traversalOn set to true, it's automatic on Windows (and those users expect it.) On Mac the user can turn on the setting in system prefs. If they haven't done that it's probably better to leave things alone since they will be used to clicking dialog options.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 10096
- Joined: Fri Feb 19, 2010 10:17 am
Re: Dialog box selections using keyboard.
I did it my way.
AND it works.
SO, you have to decide whether to stick to some vague
orthopraxis, or break out and get the functionality you require.
AND it works.
SO, you have to decide whether to stick to some vague
orthopraxis, or break out and get the functionality you require.
Re: Dialog box selections using keyboard.
Thanks for that..
I did it this way...
and it allows the user to tab to change selection.
Now I've got to dream up a way to inform the user of this facility...
I did it this way...
Code: Select all
answer question "You have entered the business name as:- " & CRLF & CRLF &\
field "compnamex" of card "template1" & CRLF & CRLF &\
"Is this correct?" with "YES" or "NO"
set the traversalon of btn "YES" to true
set the traversalon of btn "NO" to true
put it into field "fieldcr" of card "template1"
Now I've got to dream up a way to inform the user of this facility...
Re: Dialog box selections using keyboard.
You can save some typing! 
Internally LC ALWAYS uses CR as a line delimiter!

Internally LC ALWAYS uses CR as a line delimiter!
Re: Dialog box selections using keyboard.
What Richmond did is fine because he rolled his own dialog box. That is just another LC gadget.
But for a minute I thought that CAsba had made that handler
work on a "standard" answer dialog, that he was able to access the "Yes" and "No" buttons on the dialog itself. No way, and I do not want anyone else to think such a thing is possible.
Craig
But for a minute I thought that CAsba had made that handler
Code: Select all
answer question "You have entered the business name as:- " & CRLF & CRLF &\
field "compnamex" of card "template1" & CRLF & CRLF &\
"Is this correct?" with "YES" or "NO"
set the traversalon of btn "YES" to true
set the traversalon of btn "NO" to true
put it into field "fieldcr" of card "template1"
Craig
Re: Dialog box selections using keyboard.
Yes Craig and then these two lines are completely meaningless:
Even if put BEFORE the "answer..." dialog!
Code: Select all
set the traversalon of btn "YES" to true
set the traversalon of btn "NO" to true
-
- Livecode Opensource Backer
- Posts: 10096
- Joined: Fri Feb 19, 2010 10:17 am
Re: Dialog box selections using keyboard.
You either do it 'my way', or you do it 'his way' ( Atkinson, MetaCard, Miller), but do NOT mix-and-match, as it will only end in tears before bedtime.
Re: Dialog box selections using keyboard.
Klaus.
That is actually what threw me. The original intent was to be able to "work" the buttons that are presented in a standard dialog box. I asserted that was not possible, that they were unavailable for access apart from a limited number of allowed user actions, like clicking on them. But not to select one of their presented buttons by, say, arrow key or tab key.
It is simple and satisfying to roll your own; have it your way. I do it now and then, and though always happy with the result, and no offense to anyone, I am rarely particularly proud of my efforts.
All I wanted to say was that modal dialog boxes are not accessible at all beyond the few actions they permit.
Craig
That is actually what threw me. The original intent was to be able to "work" the buttons that are presented in a standard dialog box. I asserted that was not possible, that they were unavailable for access apart from a limited number of allowed user actions, like clicking on them. But not to select one of their presented buttons by, say, arrow key or tab key.
It is simple and satisfying to roll your own; have it your way. I do it now and then, and though always happy with the result, and no offense to anyone, I am rarely particularly proud of my efforts.
All I wanted to say was that modal dialog boxes are not accessible at all beyond the few actions they permit.
Craig