no dolly needed :-)

Klaus Major klaus at major-k.de
Tue Sep 2 12:57:00 EDT 2003


Hi Barry,

> 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.

Of course, the group that acts as a "container" for these images is 
still invisible!

> However, if I first made the group visible, I could then make the 
> images in that group invisible

???

You can hide/show objects in a group NO MATTER if that grp is visible 
of not!!!
Alhough this makes no "visual" sense ;-)

> (following the general thrust of your script). So the script required 
> seems to be this:

You can save a few lines and words ;-)

> -- a few lines of code above this determine which image to show
> -- and place its name into the var myImage
lock screen
> 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" <> myImage then hide 
control i of group "icons"
> end repeat
unlock screen
wait 2 seconds with messages
## in case the user should be able to do other things in the meantime
lock screen
> 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"
lock screen


BTW, this script does nothing "display"-wise... ;-)

> 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.

No no, see above...

> Still, one might wonder: So what? If the group was now visible, how 
> could I make one
> control in that group behave otherwise?

I have a little handler, which handles exactly that situation:

on all_but_one the_bg, the_ctrl
   lock screen
   repeat with i = 1 to the num of controls in bg the_bg
      hide control i of bg the_bg
   end repeat
  show control the_ctrl of bg the_bg
  unlock screen
end all_but_one

Put this into the stackscript and use it whenever you like...
(I refer to the group as "background" so it will always be found ;-)

...
   all_but_one "name of group/background", "name of object to be shown"
...

> Seems like an inconsistency (and I may be thinking  non-hierarchically 
> again).

Yo, looks like ;-)

> 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.

SOME day i will travel the world an drink ALL of these drinks...
(I'm sure my liver will "deboard" somewhere near Palmdale :-D

Hope that helps...

> Regards,
> Barry

Best from germany

Klaus Major
klaus at major-k.de
www.major-k.de




More information about the use-livecode mailing list