Page 1 of 1

Grouped Pulldown Menus (finding message & property names)

Posted: Fri Nov 11, 2011 11:49 pm
by townsend
I'm got 3 Pulldown Menu Buttons Grouped together.
Rather than place code in each button, I want to place all my code in the Group's Script area.

This code,

Code: Select all

on mouseUp
     local opp
     put the text of the target into opp
     answer opp
end mouseUp
produces this result.
143 pulldown menu example.jpeg
What can I use to capture a single choice, instead of all choices?

Re: Grouped Pulldown Menus

Posted: Sat Nov 12, 2011 12:02 am
by mwieder

Code: Select all

    on menuPick pChosen
         answer pChosen
    end menuPick

Re: Grouped Pulldown Menus

Posted: Sat Nov 12, 2011 12:02 am
by bn
Hi,
What can I use to capture a single choice, instead of all choices?
try:

Code: Select all

on mouseUp
        local opp
        put the selectedText of the target into opp
        answer opp
end mouseUp
Kind regards

Bernd

Re: Grouped Pulldown Menus

Posted: Sat Nov 12, 2011 12:54 am
by townsend
Thanks Bernd-- That worked!

Re: Grouped Pulldown Menus

Posted: Sat Nov 12, 2011 4:48 pm
by townsend
Oh yeah! Mark-- your solution worked too.

Code: Select all

  on menuPick pChosen
         answer pChosen
    end menuPick
Actually-- that menuPick message (event) is ideal for what I am trying to do.

I was going to ask you, is there any documentation or place, where I could have looked up,
"ALL messages available to Group objects?" Where I might have discovered this myself.
Then I remembered the Message Watcher, under Development, on the Menu Bar.

Re: Grouped Pulldown Menus

Posted: Sat Nov 12, 2011 6:58 pm
by bn
Hi townsend,

I think Mark's solution (menuPick) is the more logical choice
"ALL messages available to Group objects?" Where I might have discovered this myself.
When you open the dictionary and select "group" in the left part under "objects" (expand if necessary) and than select "Type" for sorting you have all properties and messages concerning groups sorted. This works of course for all categories in the dictionary.

But actually you would not have found MenuPick since it is a message that is send by menus and is passed up the message path. Since the group is in the message path you can script for the menuPick message of all menus in that group.

Kind regards

Bernd

Re: Grouped Pulldown Menus

Posted: Sat Nov 12, 2011 7:18 pm
by townsend
I didn't think of that-- excellent point there Bernd.

And, sorting the entire Dictionary by Type gives you a list of all possible Messages.
(It's really not that long.) Which is a good resource to know about.

Re: Grouped Pulldown Menus

Posted: Sat Nov 12, 2011 7:33 pm
by bn
Hi townsend,

while we are at it. Sometimes I forget the property names of objects. Than I make up a stack with a button a field and the object type I am interested in. E.g. graphic

in the button

Code: Select all

on mouseUp
   put the properties of grc 1 into tArray
   combine tArray by return and tab
   filter tArray without empty
   put tArray into field 1
end mouseUp
it lists the properties (or most so I was told) of a graphic and the actual values for the particular graphic.

Kind regards

Bernd

Re: Grouped Pulldown Menus

Posted: Sat Nov 12, 2011 8:11 pm
by townsend
Interesting-- I think that "grc" needs to be "group".
Thanks-- I just added this to my code clips library.

This code,

Code: Select all

on mouseUp
     put the properties of group "mygroup" into tArray
     combine tArray by return and tab
     filter tArray without empty
     put tArray into fld "report"
end mouseUp
Produced this report,
145 properties.jpeg

Re: Grouped Pulldown Menus

Posted: Sat Nov 12, 2011 8:13 pm
by bn
Hi,

graphic was supposed to be just an example. You can do this for all types of objects.

Kind regards

Bernd

Re: Grouped Pulldown Menus

Posted: Sat Nov 12, 2011 8:26 pm
by townsend
Yes-- of course-- this code, when placed in a button can collect ALL the properties of any object.
THEN using a Set Statement, any of those properties can be modified. (!!)

This thread turned out to be nice little lesson.
All these tips save time.