Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
townsend
- Livecode Opensource Backer

- Posts: 430
- Joined: Sun Feb 13, 2011 8:43 pm
Post
by townsend » Fri Nov 11, 2011 11:49 pm
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.
What can I use to capture a single choice, instead of all choices?
Last edited by
townsend on Sat Nov 12, 2011 11:51 pm, edited 2 times in total.
-
mwieder
- VIP Livecode Opensource Backer

- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
-
Contact:
Post
by mwieder » Sat Nov 12, 2011 12:02 am
Code: Select all
on menuPick pChosen
answer pChosen
end menuPick
-
bn
- VIP Livecode Opensource Backer

- Posts: 4172
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sat Nov 12, 2011 12:02 am
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
-
townsend
- Livecode Opensource Backer

- Posts: 430
- Joined: Sun Feb 13, 2011 8:43 pm
Post
by townsend » Sat Nov 12, 2011 12:54 am
Thanks Bernd-- That worked!
-
townsend
- Livecode Opensource Backer

- Posts: 430
- Joined: Sun Feb 13, 2011 8:43 pm
Post
by townsend » Sat Nov 12, 2011 4:48 pm
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.
-
bn
- VIP Livecode Opensource Backer

- Posts: 4172
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sat Nov 12, 2011 6:58 pm
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
-
townsend
- Livecode Opensource Backer

- Posts: 430
- Joined: Sun Feb 13, 2011 8:43 pm
Post
by townsend » Sat Nov 12, 2011 7:18 pm
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.
-
bn
- VIP Livecode Opensource Backer

- Posts: 4172
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sat Nov 12, 2011 7:33 pm
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
-
townsend
- Livecode Opensource Backer

- Posts: 430
- Joined: Sun Feb 13, 2011 8:43 pm
Post
by townsend » Sat Nov 12, 2011 8:11 pm
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,
-
bn
- VIP Livecode Opensource Backer

- Posts: 4172
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sat Nov 12, 2011 8:13 pm
Hi,
graphic was supposed to be just an example. You can do this for all types of objects.
Kind regards
Bernd
-
townsend
- Livecode Opensource Backer

- Posts: 430
- Joined: Sun Feb 13, 2011 8:43 pm
Post
by townsend » Sat Nov 12, 2011 8:26 pm
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.