Page 1 of 1
menupick in optionMenu select the last choosen item
Posted: Thu Nov 19, 2015 6:05 pm
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
Re: menupick in optionMenu select the last choosen item
Posted: Fri Nov 20, 2015 12:59 am
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.
Re: menupick in optionMenu select the last choosen item
Posted: Fri Nov 20, 2015 7:47 pm
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
Re: menupick in optionMenu select the last choosen item
Posted: Fri Nov 20, 2015 8:23 pm
by quailcreek
Take a look at menuHistory in the dictionary.
Re: menupick in optionMenu select the last choosen item
Posted: Sat Nov 21, 2015 10:37 am
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.
Re: menupick in optionMenu select the last choosen item
Posted: Sat Nov 21, 2015 5:29 pm
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.
Re: menupick in optionMenu select the last choosen item
Posted: Sat Nov 21, 2015 7:07 pm
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
Re: menupick in optionMenu select the last choosen item
Posted: Sat Nov 21, 2015 8:47 pm
by jacque
Thanks, the script helps. Menupick is not triggered if no selection is made. Set the menuHistory in a mouseRelease handler instead.
Re: menupick in optionMenu select the last choosen item
Posted: Sun Nov 22, 2015 3:20 pm
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
Re: menupick in optionMenu select the last choosen item
Posted: Sun Nov 22, 2015 9:11 pm
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?
Re: menupick in optionMenu select the last choosen item
Posted: Mon Nov 23, 2015 10:46 am
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.