Page 1 of 1

Getting Menus on Another Stack

Posted: Sat Mar 06, 2010 6:53 pm
by lohill
What is the best way to get a menubar group from one stack onto another stack without having to reconstruct it from the MenuBuilder?
I can't seem to copy and paste and when I try to do it programatically I get an error message. Here is the script for a button that I think should do it:

Code: Select all

on mouseUp
   if there is not a group "Menubar 1" on card 1 of stack "PM Contents" then
      place group "Menubar 1" of  card 1 of stack "Portfolio Manager" onto card 1 of stack "PM Contents"
   end if
end mouseUp
I get this error message:
button "Button": execution error at line 3 (place: group is not in this stack or is already on this card), char 1
In the Application Browser, I can clearly see MenuBar 1 in the single card of the stack Portfolio Manager. In the stack PM Contents I do NOT see the group. Also in the 'run' mode I see two completely different menus for those stacks.

The following two scripts which check for the presence of those menus both answer with "Yes". Any ideas?

Code: Select all

on mouseUp
   if there is not a group "Menubar 1" on card 1 of stack "PM Contents" then
      answer "Yes"
   end if
end mouseUp

Code: Select all

on mouseUp
   if there is a group "Menubar 1" on card 1 of stack "Portfolio Manager" then
      answer "Yes"
   end if
end mouseUp
Any suggestions would be appreciated.

Larry

Re: Getting Menus on Another Stack

Posted: Sun Mar 07, 2010 7:58 am
by alemrantareq
lohill,

try this -

Code: Select all

on mouseUp
   if there is not a grp "Menubar 1" on card 1 of stack "PM Contents" then
      copy grp "Menubar 1" of  card 1 of stack "Portfolio Manager" to card 1 of stack "PM Contents"
   end if
end mouseUp
Hope it'd solve your problem.

Re: Getting Menus on Another Stack

Posted: Sun Mar 07, 2010 4:37 pm
by lohill
Thanks alemrantareq,

That worked like a charm. Is it safe to say that 'copy - to' is always a better choice than 'place - onto' for situations like this? Are there situations where 'place - onto' is required?

Regards,
Larry

Re: Getting Menus on Another Stack

Posted: Sun Mar 07, 2010 5:04 pm
by Klaus
Hi Larry,

you can only "place" backgrounds "onto" cards in the same stack, not across stacks!
That's why you need to copy here :)


Best

Klaus