Option Menu using arrows and enter returns nothing in menuPi

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bergsy
Posts: 45
Joined: Mon Oct 28, 2013 10:51 pm

Option Menu using arrows and enter returns nothing in menuPi

Post by bergsy » Thu Apr 16, 2015 2:44 am

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Option Menu using arrows and enter returns nothing in me

Post by dunbarx » Thu Apr 16, 2015 3:01 pm

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:

Code: Select all

on enterkey
put the selectedText of me
end enterkey
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.
Last edited by dunbarx on Tue Apr 28, 2015 2:43 pm, edited 1 time in total.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Option Menu using arrows and enter returns nothing in me

Post by jacque » Thu Apr 16, 2015 7:42 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Option Menu using arrows and enter returns nothing in me

Post by dunbarx » Thu Apr 16, 2015 7:58 pm

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

bergsy
Posts: 45
Joined: Mon Oct 28, 2013 10:51 pm

Re: Option Menu using arrows and enter returns nothing in me

Post by bergsy » Tue Apr 28, 2015 2:51 am

Seems I didn't submit my previous post on this

The enterkey function never gets hit.....so not sure what to do from here

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Option Menu using arrows and enter returns nothing in me

Post by dunbarx » Tue Apr 28, 2015 2:37 pm

Hi.

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
You will get the selected choice in msg when you use the mouse, or use the arrow keys and then hit "enter".

Craig

Post Reply