Squeakland friends:
If you create a new flap to store some morphs to have them ready for future use, a number is added to the morph´s name when you put the object into that flap. When you extract the object (a copy) from the flap, you once again get another sequencial number appended to its name. I find that this is different from the objects you get from the standard "Supplies" flap. Is there any way to store/retrieve morphs into/out-of your flap with the name you originally assigned to the morph? No numbers appended? I find it necessary when you use multiples copies of those morphs that execute some scripts, because otherwise you may loose the connection with the class of the original object in your scripting execution.
Thanks for your help.
Regards from Quito-Ecuador
Gustavo Correa H.
Hi, Gustavo,
I presume you have created a new flap and instructed it (via the tab's halo menu) to be a "parts bin"?
I find that dropping an object whose name is "abc" into a parts-bin flap results in an object in the flap named "abc", without any number after it. So I wonder what I'm doing differently from you, that I get this different result???
Perhaps you added the object to the parts bin by obtaining a copy using the green or olive halo handle? *That* would result in an object named "abc1" (since duplicates torn off with the green/olive halo handle are always given unique names,) and if so, that object, when dropped in the flap, would settle there with the name "abc1".
Could that be what you're experiencing? If so, here are two solutions:
* Tear off the duplicate, and instead of dropping it directly into the flap, first drop it on the desktop, edit the name in the halo to be exactly what you want (without the annoying digits,) *then* grab that object and drop it in the flap.
* Alternatively, even after you've dropped it in the flap, you can bring up its halo and edit the name.
However, please read on, since I believe your real issue point has to do not with object names but rather with object *classes*, so let me address that...
I find it necessary when you use multiples copies of those morphs that execute some scripts, because otherwise you may loose the connection with the class of the original object in your scripting execution.
The *name* of an object (as seen in the halo, and at the top of a Viewer) really can have no bearing on the *class* of the object. There must be some other explanation for why you're sometimes losing connections with original classes.
It's important to realize -- and not widely known -- that if you have a scripted object in a parts bin, and you drag out ("tear off") a fresh copy of that object from that parts bin, the object you will obtain will *always* be an instance of a new and different class -- *not* a sibling instance of the original object.
(It's not unreasonable to expect that this should work differently, i.e. that it should be possible to obtain genuine siblings from a parts bin; but this is the way it works right now.)
The only ways to get "siblings" -- i.e. instances of the same class -- are by using the olive halo handle, or the halo-menu items for making siblings found in the "halo actions" and "siblings..." submenus, or using the scripting tile named "copy." To repeat: You cannot obtain a sibling instance from a parts bin, you always get an instance of a new class. (The more I think about this, the more I realize how regrettable this is...)
If that doesn't explain the phenomenon you're seeing, would you please send a copy of a project that illustrates your issue. If the project is smallish, you could send it to the mailing list, but if it's large, perhaps just send it to me, and I'll have a look -- thanks :=)
Cheers,
-- Scott
At 9:55 AM -0500 3/23/05, Gustavo Correa H. wrote:
Squeakland friends:
If you create a new flap to store some morphs to have them ready for future use, a number is added to the morph´s name when you put the object into that flap. When you extract the object (a copy) from the flap, you once again get another sequencial number appended to its name. I find that this is different from the objects you get from the standard "Supplies" flap. Is there any way to store/retrieve morphs into/out-of your flap with the name you originally assigned to the morph? No numbers appended? I find it necessary when you use multiples copies of those morphs that execute some scripts, because otherwise you may loose the connection with the class of the original object in your scripting execution.
Thanks for your help.
Regards from Quito-Ecuador
Gustavo Correa H.
On Thursday 24 March 2005 3:35 am, Scott Wallace wrote:
It's important to realize -- and not widely known -- that if you have a scripted object in a parts bin, and you drag out ("tear off") a fresh copy of that object from that parts bin, the object you will obtain will *always* be an instance of a new and different class -- *not* a sibling instance of the original object.
(It's not unreasonable to expect that this should work differently, i.e. that it should be possible to obtain genuine siblings from a parts bin; but this is the way it works right now.)
The only ways to get "siblings" -- i.e. instances of the same class -- are by using the olive halo handle, or the halo-menu items for making siblings found in the "halo actions" and "siblings..." submenus, or using the scripting tile named "copy." To repeat: You cannot obtain a sibling instance from a parts bin, you always get an instance of a new class. (The more I think about this, the more I realize how regrettable this is...)
Actually, there is an alternative kind of flap available that works as you want. So Scott doesn't have to do any work to make this happen.
These are the flaps that I made as part of Connectors; these always make siblings.
If you go to the Objects tool, go to the "Connectors" page, and drag out a "Button Flap", you will have a flap that works like this:
* a right (or middle) mouse click will bring up a context menu.
* Choosing 'add button' will add a Maker Button to the flap.
* Dropping a scripted Morph (and/or one with instance variables) on the button will make a sibling of that morph to use as a prototype. (if the morph does not have scripts or instance variables, you just get a copy)
* Clicking on the button (after you drop a morph on it) will give you a sibling of the prototype (which is also a sibling of your original morph) in hand.
* Dragging from the button (as you are used to doing with flaps) will also do the same thing.
Give it a try!
squeakland@lists.squeakfoundation.org