Manipulating an object cloned from a group - no cloning needed
Barry Levine
themacguy at macosx.com
Tue Sep 2 11:45:02 EDT 2003
Klaus,
I had latched onto the "copy" and "clone" commands as an alternative to
failing to make only one specific image in a hidden group of images
visible. The answer was found within your reply. Prior to your post I
had tried:
set the visible of image "mail" to true
That didn't work. I then tried the same line but modified like this:
set the visible of image "mail" of group "icons" to true
That didn't work. However, if I first made the group visible, I could
then make the images in that group invisible (following the general
thrust of your script). So the script required seems to be this:
-- a few lines of code above this determine which image to show
-- and place its name into the var myImage
set the lockScreen to true
show group "icons" -- always named thusly
repeat with i = 1 to the number of controls in group "icons"
if the short name of control i of group "icons" is myImage then
-- do nothing
else
hide control i of group "icons"
end repeat
set the lockScreen to false
wait 2 seconds -- or the appropriate amount of time
set the lockScreen to true
repeat with i = 1 to the number of controls in group "icons"
show control i of group "icons" -- there are never more than 7 total
end repeat
hide group "icons"
set the lockScreen to false
Now I don't need to "copy" or "clone" anything. I had been frustrated
by the inability to make visible just one control in that group; of
course, I had not been thinking hierarchically - the group was
invisible therefore I had to make it visible first before I could make
the rest of the objects in that group INvisible. Still, one might
wonder: So what? If the group was now visible, how could I make one
control in that group behave otherwise? Seems like an inconsistency
(and I may be thinking non-hierarchically again). However, I'm not
complaining as the problem seems to be resolved in a manner that plays
nicely with encryption.Thanks again for your help. I owe you another
beer.
Regards,
Barry
On Tuesday, Sep 2, 2003, at 06:19 America/Denver, Klaus illuminated:
> Date: Tue, 2 Sep 2003 13:08:14 +0200
> Subject: Re: Manipulating an object cloned from a group
> From: Klaus Major <klaus at major-k.de>
> To: use-revolution at lists.runrev.com
> Reply-To: use-revolution at lists.runrev.com
>
> Hi Barry,
>
>> If I clone an object belonging to an invisible group, the new object
>> belongs to that group.
>> If I'd like to manipulate that object all by its lonesome (make it
>> visible, change its location,
>> and delete it), how would I go about doing this?
>
> You can do this, assumed the name of the cloned grp = "clone"
> (not very clever, i know ;-)
> ...
> set the loc of btn "bill" of grp "clone" to 100,100
> ## will distinguish this button from the button with the same name of
> grp "original"
> ...
> delete btn "bill" of grp "clone"
> ...
>
> To make one object of an invisible grp visible i would use a
> repeat-loop like:
> ...
> repeat with i = 1 to the num of controls of grp "clone"
> hide control i of grp 1
> end repeat
> ### necessary since we have to set the group to visible!!!
> show btn "bill" of grp "clone"
> ...
>
> Un-/lock screen will speed things up, if you have lots of controls...
>
> Hope that helps...
> Regards
> Klaus Major
More information about the use-livecode
mailing list