Creating a reusable object

Mark Smith Mark_Smith at cpe.umanitoba.ca
Wed Aug 8 00:34:48 EDT 2012


According to Kevin's presentation at RRLive '12 this should be easy. So what
am I doing wrong? I want to create a reusable graphic object that would sit
at the left edge of some cards, and not others. So, here goes...

Create a rectangle object, make it opaque, i filled mine with 20% grey. It
will also be fixed width so I set it to the width I want. To make it
reusable it will need to be able to respond to messages so we must put it in
the message path. So, group the object, select "behave like a background"
but set "shared group" off. I don't want it on every card, just some.

Select the script of the group and include the following:

on resizestack
   set the height of graphic 1 of me to the height of this card
   set the topleft of graphic 1 of me to 0,0
   pass resizestack
end resize stack

So far so good. When you resize the card the object resizes to the left of
the card. Now, since I don't want it selectable I also set the rectangle to
disabled and in the application browser set the rectangle to unselectable.
So, now it lives on the left of the card and resizes, but is not selectable.
All good.

Now the fun begins.

I make a new card. The graphic shows up (shouldn't have if I understand
"shared group" correctly). So, I try and delete the object from the second
card and it deletes it from the first card too.

So, looks like I have a shared object that behaves like a background, not a
reusable object that responds to messages. 

Where did I screw up? Have tried this a few times and always get the same
result.

Thanks




--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Creating-a-reusable-object-tp4653514.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list