Copying items between cards and retaining geometry data

This is the place to discuss anything relating to MobGUI

Moderators: heatherlaine, kevinmiller, robinmiller, malte, splash21

Post Reply
andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Copying items between cards and retaining geometry data

Post by andyh1234 » Tue Nov 29, 2011 6:39 pm

Is it possible to copy items between cards, and somehow retain their geometry data?

As an example, I have an android menu in a group im firing from the menukey command. I need a copy of the group on each card that would support the menu, and each card has formatting for the popular Android resolutions eg. 480x800, 240x400 etc etc.

If I use copy and paste all the items go over to the new card, but then when I use MobGUI to change the card size the items do not resize as they did on the original card, so it looks like the data is not being copied.

Is there an easy way to do this???

Thanks

Andy

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Re: Copying items between cards and retaining geometry data

Post by andyh1234 » Wed Nov 30, 2011 12:43 am

Just in case anyone else needs to do the same thing, I have a solution to the menu.

By putting the menu group on the first card loaded (hidden), then adding the code below in the stack handler MobGUI will resize the menu just fine during the initial load of the first card, and then the copy simply copies the correctly sized menu to the card that called it.

There may be a better way, but this is working for me, and means I only need the menu group in a single location and can resize it for all the different Android screen sizes.

Code: Select all

on menuKey   
   if there is not a grp "AndroidMenu" then
      copy group "AndroidMenu" of card "First" to this card
   end if
   
    lock screen for visual effect in rect (the rect of grp "AndroidMenu")
    show group "AndroidMenu"        
    set the layer of group "AndroidMenu" to top
    wait 0 with messages
    unlock screen with visual effect "scroll up very fast" 
end menuKey

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7258
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Copying items between cards and retaining geometry data

Post by jacque » Wed Nov 30, 2011 5:38 am

The usual way to do this is to create a group with backgroundBehavior set to true, and then place the group on every card (not copy it.) Create the group one time, then use the "Place group" menu item in the Objects menu on each card, which puts a visual representation of the same group on the card. Any changes to the group will reflect on all the cards automatically. What you're doing is basically creating a pointer on each card to a single group object.

I haven't tried it with MobGUI but I would imagine it would work, since this is the usual way to manage menus.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Re: Copying items between cards and retaining geometry data

Post by andyh1234 » Wed Nov 30, 2011 9:36 am

Thanks, Ill give that a try and see if it works!

Post Reply

Return to “MobGUI”