Option Menu using arrows and enter returns nothing in menuPi
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Option Menu using arrows and enter returns nothing in menuPi
Hi,
I am having an issue with Option menus.
When I click and select items using the mouse, everything is fine. The pItemName in the menupick function has the value I expect.
If I use arrow keys to align to the option I want and then press enter then the pItemName in the menupick function is empty.
Also, sometimes the vertical scrollbar can't be dragged with the mouse, but that is a lesser issue.
If I change the button type to pulldown menu then the arrow/enter selection works fine, but that is not the interaction I want with the user.
I am wondering what I might be doing wrong, or whether this is functionality I can't expect from an option menu.
Any ideas appreciated
Thanks
Bergsy
I am having an issue with Option menus.
When I click and select items using the mouse, everything is fine. The pItemName in the menupick function has the value I expect.
If I use arrow keys to align to the option I want and then press enter then the pItemName in the menupick function is empty.
Also, sometimes the vertical scrollbar can't be dragged with the mouse, but that is a lesser issue.
If I change the button type to pulldown menu then the arrow/enter selection works fine, but that is not the interaction I want with the user.
I am wondering what I might be doing wrong, or whether this is functionality I can't expect from an option menu.
Any ideas appreciated
Thanks
Bergsy
Re: Option Menu using arrows and enter returns nothing in me
Hi.
In order to use the enterKey to invoke an action, you have to trap a message that is generated in that world. Put this in the option button script:
Craig Newman
EDIT.
Hmmm. I thought this made sense, but it seems that, just like with arrowKeys, no "enterKey" message is sent when inside an "open" hierarchal button. This is related to the thread in the "Talking Livecode" forum "ArrowKeys work and do not work". Fortunately, a menuPick message is indeed sent in either case. See the comments further along in this thread.
In order to use the enterKey to invoke an action, you have to trap a message that is generated in that world. Put this in the option button script:
Code: Select all
on enterkey
put the selectedText of me
end enterkey
EDIT.
Hmmm. I thought this made sense, but it seems that, just like with arrowKeys, no "enterKey" message is sent when inside an "open" hierarchal button. This is related to the thread in the "Talking Livecode" forum "ArrowKeys work and do not work". Fortunately, a menuPick message is indeed sent in either case. See the comments further along in this thread.
Last edited by dunbarx on Tue Apr 28, 2015 2:43 pm, edited 1 time in total.
Re: Option Menu using arrows and enter returns nothing in me
On my Mac, a menupick message is sent after hitting the Enter key and can be handled normally without using an enterkey handler.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Option Menu using arrows and enter returns nothing in me
Jacque,
Just so. I wanted to allow the OP to perhaps expand his, er, options.
This engendered the thread on arrowKeys and popUps, etc, in the "Talking LiveCode" forum.
Craig
Just so. I wanted to allow the OP to perhaps expand his, er, options.
This engendered the thread on arrowKeys and popUps, etc, in the "Talking LiveCode" forum.
Craig
Re: Option Menu using arrows and enter returns nothing in me
Seems I didn't submit my previous post on this
The enterkey function never gets hit.....so not sure what to do from here
The enterkey function never gets hit.....so not sure what to do from here
Re: Option Menu using arrows and enter returns nothing in me
Hi.
What is happening? If you make a new option menu, and place this in its script:
You will get the selected choice in msg when you use the mouse, or use the arrow keys and then hit "enter".
Craig
What is happening? If you make a new option menu, and place this in its script:
Code: Select all
on menuPick pItemName
switch pItemName
case pItemName
put pItemName
break
end switch
end menuPick
Craig