menupick in optionMenu select the last choosen item

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

menupick in optionMenu select the last choosen item

Post by jmburnod »

Hi All
I have noticed that menupick in an optionMenu on iOS select the last choosen item by user.
Is there a way to avoïd this ? (LC 7.05, xCode 6.4, iOS 8.4)
Best regards
Jean-Marc
https://alternatic.ch
quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: menupick in optionMenu select the last choosen item

Post by quailcreek »

After the user interaction you can set the label of the button to what you want. Of course there are better ways in iOS for accessing a list of items. Look at mobilePick in the dictionary.
Tom
MacBook Pro OS Mojave 10.14
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: menupick in optionMenu select the last choosen item

Post by jmburnod »

Hi quailcreek,
Thanks for reply
On the previous version I use a group with two transparent buttons, one for iOS with mobilepick and one for OS X/windows with menupick.
I wonder if I can simplify and have one btn for each, but although I set the label to empty, menupick select the last choosen item on the list.
Best regards
Jean-Marc
https://alternatic.ch
quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: menupick in optionMenu select the last choosen item

Post by quailcreek »

Take a look at menuHistory in the dictionary.
Tom
MacBook Pro OS Mojave 10.14
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: menupick in optionMenu select the last choosen item

Post by jmburnod »

I tried set the menuhistory to 0 or empty but i get same result.
The first item is selected and sent when I click outside the menus list.
https://alternatic.ch
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: menupick in optionMenu select the last choosen item

Post by jacque »

Can you post the relevant parts of the button script? That will give us more information about which messages it traps and how it manages them.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: menupick in optionMenu select the last choosen item

Post by jmburnod »

Here is the script

Code: Select all

on menuPick pItemName
   set the menuhistory of the target to 0
   answer (pItemName = empty)
end menuPick
I expect pItemname = empty if I click outside the menu list but It keep last choosen item
https://alternatic.ch
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: menupick in optionMenu select the last choosen item

Post by jacque »

Thanks, the script helps. Menupick is not triggered if no selection is made. Set the menuHistory in a mouseRelease handler instead.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: menupick in optionMenu select the last choosen item

Post by jmburnod »

Hi Jacqueline,
I put a mouserelease in btn script but I get same result

Code: Select all

on mouserelease
      set the menuhistory of the target to 0
end mouserelease
https://alternatic.ch
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: menupick in optionMenu select the last choosen item

Post by jacque »

I'm not sure what you want the option button to do. I don't see a way to have an option button without a selection. If the menuhistory is 0, the first item in the list will be selected by default when it is clicked. If you set the label to empty, the name will appear by default. What behavior would you like to see?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: menupick in optionMenu select the last choosen item

Post by jmburnod »

I want the same behavior on iOS, OS X and windows.
When I click outside the menus list I want to exit from this script. This is what I see on OS X and windows for an option menu.
On iOS if I click outside the menus list it seems ignore the mouseLoc is outside the menus list and doesn't exit.

I choosed option type because popup and pulldown hide all the screen on iOS.

In previous version of my app, I use a group with one transparent btn with mobilepick for iOS and one popup btn for OS X and Windows with menupick
I thought there is a way to avoïd manage this.
https://alternatic.ch
Post Reply