Page 1 of 1
Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 5:41 am
by tjo7777
I have a pull down menu with several options available.
Is there a way I can change the selection of the pull down menu from another handler?
I tried a bunch of things like this:
Code: Select all
if item = 6 then
set the selection of button "Custom Items" to menuitem 6
end if
I tried all the variations I could think of without success.
Thanks to anyone who can offer suggestions or advice,
TJ.
Re: Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 1:50 pm
by Klaus
Hi TJ,
sorry, I don't have the slightest idea what you are after,
and your (invalid) script snippet is also not very enlightening.
Do you mean:
When the user selects any menuitem of menu btn "menuA" then you want also to
execute the command of the coresponding (same line in menu?) menuitem of btn "menub"
as if the user selected that menuitem with the mouse?
Best
Klaus
Re: Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 3:07 pm
by magice
If you just want to change the displayed choice of the dropdown, you can do it by changing the "label". If you want to simulate the choice of one of the items, then try this:
Code: Select all
send "menuPick myChoice" to btn "myDropDownBtn"
Re: Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 3:13 pm
by Klaus
magice wrote:If you just want to change the displayed choice of the dropdown, you can do it by changing the "label".
Yep, that was what I also thought first, but the TS is talking about PULL-DOWN menu buttons, which do not have a (dynamic) label like e.g. an option-button.
Re: Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 3:26 pm
by magice
Klaus wrote:
Yep, that was what I also thought first, but the TS is talking about PULL-DOWN menu buttons, which do not have a (dynamic) label like e.g. an option-button.
Yes, I see what you mean. So, he must want to simulate the choice.
Re: Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 3:55 pm
by tjo7777
Thank you for all the replies, sorry if I did a poor job of explaining my issue.
I was looking for something like what magice posted.
Code: Select all
send "menuPick myChoice" to btn "myDropDownBtn"
Basically I want to simulate a choice being made on the drop down menu.
As Klaus pointed out it does not seem to have a dynamic label, so its not as easy as setting the label to a new value.
Thanks for all the help. I don't know if its possible to do this, but I do appreciate all your efforts and replies.
TJ
Re: Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 4:02 pm
by magice
tjo7777 wrote:Thank you for all the replies, sorry if I did a poor job of explaining my issue.
I was looking for something like what magice posted.
Code: Select all
send "menuPick myChoice" to btn "myDropDownBtn"
Basically I want to simulate a choice being made on the drop down menu.
As Klaus pointed out it does not seem to have a dynamic label, so its not as easy as setting the label to a new value.
Thanks for all the help. I don't know if its possible to do this, but I do appreciate all your efforts and replies.
TJ
sending menuPick should work, but you will need to use the actual choice as written in in the button ("myChoice" in the above example) instead of a menuItem number.
Re: Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 4:32 pm
by tjo7777
Hi magice,
Thank you for your help.
I did try using menuPick and it did not seem to work on the drop down type menu.
However to my pleasant surprise today it seems to work using "set the label of btn". I swear yesterday I tried that and it didn't work?! Probably it was my mistake.
Anyway I came up with a sort of work around for using this drop down menu.
Code: Select all
set the label of button "Custom Tags" to "Custom Tag 6"
put the label of button "Custom Tags" into currenttag
put currenttag into line 5 of field "Field"
In this way I can set the value of the label, and then use that label value as a way to know what the current selection is.
You need to be careful though, because you can set the value of the label to anything, even things that are not listed as choices in the dropdown menu. So in a way the menu is just a kind of window dressing when I use it this way. Its probably not the way the designers intended the dropdown menu to be used, but it seems to work for my application.
Thanks again for your help,
TJ.
Re: Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 4:40 pm
by Klaus
Hi TJ,
yes, mis-using a pulldown menu button to change its label IS in fact a violation of any thinkable HIG
But ou can also "trigger" a menu item if you only have the NUMBER of that item:
...
set the menuhistory of btn "your pull-down here" to 2
...
Will cause the same as if the user had selected that secdond menu item!
Best
Klaus
Re: Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 4:58 pm
by magice
Klaus wrote:Hi TJ,
yes, mis-using a pulldown menu button to change its label IS in fact a violation of any thinkable HIG
But ou can also "trigger" a menu item if you only have the NUMBER of that item:
...
set the menuhistory of btn "your pull-down here" to 2
...
Will cause the same as if the user had selected that secdond menu item!
Best
Klaus
menuHistory! that is what I was trying to remember. I have spent the last 45 minutes going through the dictionary in an attempt to find it. Do what Klaus said, use menuHistory.
Re: Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 7:59 pm
by tjo7777
THANK YOU!!!
Yes, it seems menuhistory is what I was looking for! I did try to search on my own for quite a while, but somehow missed this.
Cheers,
TJ.
Re: Select a pull down menu item from another handler...
Posted: Wed Feb 25, 2015 10:20 pm
by dunbarx
Gee, I read this entirely differently. And wrongly, perhaps.
I thought, because of:
Code: Select all
Is there a way I can change the selection of the pull down menu from another handler?
I thought the OP wanted to be able to open an ad hoc set of choices from a pulldown from a running handler:
Code: Select all
put yourNewList into button "yourPullDown"
click at the loc of btn "yourPullDown"
Thus reloading the menu options as needed, and open that menu for selection. Totally wrong, I suppose?
Craig Newman
Re: Select a pull down menu item from another handler...
Posted: Tue Jul 24, 2018 7:24 pm
by mrcoollion
Small addendum to this older post.
This is also possible:
Code: Select all
if the label of button "MyPulldownmenuButtonName" = line 1 of button "MyPulldownmenuButtonName" then set the label of button "MyPulldownmenuButtonName" to line 2 of button "MyPulldownmenuButtonName"