User Interface Question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
User Interface Question
I have a card with about a half dozen fields. This will be a modal (sheet) substack. The user will tab from field to field entering data. In a few of those fields, there are some limited choices based upon what the user has provided by entering data in earlier fields. As an example:
Field 1 - The user may enter the word "DAY".
Field 2 - Based upon the entry in Field 1, Field 2 should display a popup with a list of the days of the week. The user ideally would arrow up or down and press the Enter (Return on Mac) or Tab key which would accept the entry and tab over to...
Field 3 - where, depending on which day of the week the user chose, some other choice list would present itself.
I can readily see how to change what data should appear (as there are limited choices) but the part I'm having trouble with is how to do it all with the keyboard. I'd like to only require the mouse for the "Cancel" or "Accept" buttons. I've seen this done on Windows (presumably MS Access) but I'd love to see this done with LiveCode if possible.
It does not appear that the various popups and combo boxes are very keyboard-friendly. Ideas and suggestions?
Thanks,
Barry
Field 1 - The user may enter the word "DAY".
Field 2 - Based upon the entry in Field 1, Field 2 should display a popup with a list of the days of the week. The user ideally would arrow up or down and press the Enter (Return on Mac) or Tab key which would accept the entry and tab over to...
Field 3 - where, depending on which day of the week the user chose, some other choice list would present itself.
I can readily see how to change what data should appear (as there are limited choices) but the part I'm having trouble with is how to do it all with the keyboard. I'd like to only require the mouse for the "Cancel" or "Accept" buttons. I've seen this done on Windows (presumably MS Access) but I'd love to see this done with LiveCode if possible.
It does not appear that the various popups and combo boxes are very keyboard-friendly. Ideas and suggestions?
Thanks,
Barry
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: User Interface Question
Hi,
You have to first choose whether or not a menu-type button will do wherever the choice option occurs. in other words, when the subsequent "field" after the user enters "day" is in focus, are the ONLY options for that control a day of the week? In still other words, if so, then that control can be a pullDown menu button instead of a field.
Let us assume so.
The trick is to set the contents of the button to something appropriate, derived from the entry of the previous field. So if "DAY" is entered into the field, then a closeField handler in the card script will load, likely from a custom property, a list of days.
This is done simply by:
You can have as many properties as you need, all loaded based on the contents of the entry field. This will require some management, and woe if the user misSpells "DAY".
Need more?
Craig Newman
You have to first choose whether or not a menu-type button will do wherever the choice option occurs. in other words, when the subsequent "field" after the user enters "day" is in focus, are the ONLY options for that control a day of the week? In still other words, if so, then that control can be a pullDown menu button instead of a field.
Let us assume so.
The trick is to set the contents of the button to something appropriate, derived from the entry of the previous field. So if "DAY" is entered into the field, then a closeField handler in the card script will load, likely from a custom property, a list of days.
This is done simply by:
Code: Select all
put the dayList of this cd into btn yourButton
Need more?
Craig Newman
Last edited by dunbarx on Tue May 08, 2018 3:41 pm, edited 1 time in total.
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: User Interface Question
But doesn't what you suggest still require the user to operate the mouse in order to make a choice?
I can get the appropriate data into the "subsequent" field/button/whatever, but it appears LC is missing a "drop-down list" (which I think Access has). In HyperCard, I used an XCMD called (something like) "choiceList" so, when tabbing into a field, the choice list appeared and, whichever choice the user made (usually with arrow keys and a "return") ended up in that field.
I can get the appropriate data into the "subsequent" field/button/whatever, but it appears LC is missing a "drop-down list" (which I think Access has). In HyperCard, I used an XCMD called (something like) "choiceList" so, when tabbing into a field, the choice list appeared and, whichever choice the user made (usually with arrow keys and a "return") ended up in that field.
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: User Interface Question
I assume you know that LC has four different styles of button that "drop down".
Is it that you want to both populate the "subsequent" control and also have it automatically pop up with those choices, ready to select?
You still need the mouse to make the selection, unless you want, say, the arrow keys to do the walking for you.
No problem either way, or maybe in some other way, but write back...
Craig
Is it that you want to both populate the "subsequent" control and also have it automatically pop up with those choices, ready to select?
You still need the mouse to make the selection, unless you want, say, the arrow keys to do the walking for you.
No problem either way, or maybe in some other way, but write back...
Craig
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: User Interface Question
Yes, no mouse at all until the final "Accept" to dismiss the modal dialog (although having a keyboard shortcut for that, as well, would be great). I know how to populate the control with the necessary data but can't figure out how to make it appear expanded (showing the choice list) when I tab to it. Maybe I'll need to show and hide a list field programmatically? How does this latter method sound? I just want the tab into the subsequent field to trigger the appearance of the list designed for that field (and, if it's a field I make visible, shift the keyboard focus to that field - hmmm...).dunbarx wrote: ↑Tue May 08, 2018 3:11 amsnip...Is it that you want to both populate the "subsequent" control and also have it automatically pop up with those choices, ready to select?
You still need the mouse to make the selection, unless you want, say, the arrow keys to do the walking for you.
No problem either way, or maybe in some other way, but write back...
Craig
Thanks,
Barry
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: User Interface Question
Hi Barry,
Here is a quick try
select fld by ArrowKey left/right
select menuitem by ArrowKey Up/Down
confirm your choice or cancel by returnkey Best regards
Jean-Marc
Here is a quick try
select fld by ArrowKey left/right
select menuitem by ArrowKey Up/Down
confirm your choice or cancel by returnkey Best regards
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: User Interface Question
I think what the OP really wants is this:
On a new card place a field and a pullDown menu button. In the card script:
Type into the field, either "day" or "fruit". Tab out of the field. Now use the U/D arrowKeys to select an option.
I have the handler in the card script, so that multiple fields will fire. But you will need to discriminate among them by analyzing the "target" to see which field has been tabbed out of, so the handler can click on the appropriate pullDown. And you can use "target" (the contents of the target) to see what text has been entered.
Again, the information loaded ought to reside in custom properties:
There are surely a few more housekeeping chores to make this really clean. And why not challenge yourself to allow the arrowKeys to cycle continuously through the menu list?
Craig
On a new card place a field and a pullDown menu button. In the card script:
Code: Select all
on tabKey
if fld 1 = "day" then put "Mon" & return & "Tue" & return & "Wed" into btn 1
else if fld 1 = "fruit" then put "Pear" & return & "Apple" & return & "Peach" into btn 1
click at the loc of btn 1
end tabKey
I have the handler in the card script, so that multiple fields will fire. But you will need to discriminate among them by analyzing the "target" to see which field has been tabbed out of, so the handler can click on the appropriate pullDown. And you can use "target" (the contents of the target) to see what text has been entered.
Again, the information loaded ought to reside in custom properties:
Code: Select all
if target = "day" then set the text of btn "appropriateButton" to the dayList of this card
Craig
Last edited by dunbarx on Wed May 09, 2018 3:52 pm, edited 3 times in total.
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: User Interface Question
Yes; that seems to be very close to what I need. Probably will have to tweak the card script a bit to make it conform to the UI I need (automatically tab to the next field when the previous field's choice is chosen with the Return key) but, essentially, this is what I was hoping for. Many thanks for your efforts! I did not think about the popup menu for this task; it makes perfect sense.
Thanks,
Barry
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: User Interface Question
Welcome Barry
That was a pleased to work with someone from the other side of Pecos River
Jean-Marc from de east of the Pecos
That was a pleased to work with someone from the other side of Pecos River
Jean-Marc from de east of the Pecos
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 474
- Joined: Thu Sep 04, 2008 6:23 am
- Location: Melbourne Australia
Re: User Interface Question
Have you looked in the dictionary at the following terms:
tabGroupBehavior, focus
And of course the entries ‘related’ to these terms.
You might find your answer there.
tabGroupBehavior, focus
And of course the entries ‘related’ to these terms.
You might find your answer there.
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: User Interface Question
Barry.
Did you make the experiment of about four posts above? All that you need, I think, is there.
Let me know if I am still not getting it.
Craig
Did you make the experiment of about four posts above? All that you need, I think, is there.
Let me know if I am still not getting it.
Craig
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: User Interface Question
I haven't yet had a chance to fool around much with Jean-Marc's stack although I can see that it is essentially the solution I need. I'll need to add a bit of code so that accepting the choice in a field will move the focus to the next field until the last field's choice has been done. Then a mouseClick on the "Accept" button will trigger the handler to gather the choices in global vars, dismiss the modal dialog, and update the card (in the main stack).
Using a menu popup in such a programmatic fashion and not as an actual menubar never occurred to me. D-oh!
The goal of this is to make my app use as little of the mouse as possible. My target is an old DOS-based app and the mouse only slows things down.
Many thanks to everyone!
Barry
Using a menu popup in such a programmatic fashion and not as an actual menubar never occurred to me. D-oh!
The goal of this is to make my app use as little of the mouse as possible. My target is an old DOS-based app and the mouse only slows things down.
Many thanks to everyone!
Barry
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: User Interface Question
Hi Barry,
Best regards
Jean-Marc
It seems you just have to add " arrowkey right " at the end of menupick messageI'll need to add a bit of code so that accepting the choice in a field will move the focus to the next field until the last field's choice has been done
Code: Select all
on menupick pItemName
get char 7 to -1 of the short name of the target
if pItemName = "Cancel" then exit menupick
put pItemName into fld ("fText" & it)
arrowkey right --•• add jmb002
end menupick
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: User Interface Question
It is one of the pleasures of LC that the user can interface with controls in unusual ways. That there is a way to have a handler click on a menu button and have that action perfectly simulate a physical mouse click is, well, adorable.
And powerful. You can avoid using the mouse entirely if you want to.
As for moving focus to various places, that can all be done under script control, sequentially or in any other way, managed in a single card handler. If you make my experiment, try to expand it with three fields and three menu buttons, all directed by the target and "target".
Craig
And powerful. You can avoid using the mouse entirely if you want to.
As for moving focus to various places, that can all be done under script control, sequentially or in any other way, managed in a single card handler. If you make my experiment, try to expand it with three fields and three menu buttons, all directed by the target and "target".
Craig
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: User Interface Question
Strange results.
- If I mouseClick on each field, everything works.
- If I use the arrowKey to move from field to field, everything works.
However, if the mouse pointer is outside of the stack window (and I use the keyboard arrows), it fails with an error:
...then, when I click in that script window, the popup menu actually appears when I click on the blue "stop" button at the top of the script window (but only when I click there and, of course, I do have to click there to get back to my stack).
Here's the handler:
Sometimes I even see the popup menu appearing in the IDE toolbar (if the mouse pointer is over there). I've tried changing the offending line to:
...but that didn't change anything.
I can't understand why LC seems to think "the target" is the mouseLoc.
Barry
- If I mouseClick on each field, everything works.
- If I use the arrowKey to move from field to field, everything works.
However, if the mouse pointer is outside of the stack window (and I use the keyboard arrows), it fails with an error:
Code: Select all
card "cPopUpByKB001": execution error at line 9 (subwindow: can't find stack or button), char 36
Here's the handler:
Code: Select all
on defTextMU
get char 6 to -1 of the short name of the target
if there is a btn ("bMyPop" & it) then
popup btn ("bMyPop" & it) at the loc of the target -- [i]this is the offending line[/i]
end if
end defTextMU
Code: Select all
popup btn ("bMyPop" & it) at the loc of field ("fText" & it)
I can't understand why LC seems to think "the target" is the mouseLoc.
Barry