Showing/hiding objects in an invisible group - it works

Barry Levine themacguy at macosx.com
Tue Sep 2 16:17:01 EDT 2003


Thought I should post the solution to the problem I posed (and which 
Klaus & Mark addressed). Here's the handler in the field script:
-----
on mouseDown
   put the clickChunk into whatWasClicked
   put the value of whatWasClicked into theWord
   set the lockScreen to true
   if there is a group "icons" then
     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 theWord then
         -- do nothing
       else
         hide control i of group "icons"
       end if
     end repeat
     set the lockScreen to false
     wait 1.252 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
     select empty
   end if
end mouseDown
-----
The "clickChunk" function works for me as I've previously set 
individual words or phrases in the field to a style of "link". In order 
to make it -not- obvious that the text was a link, I also unchecked 
"Underline links" in the stack's Object Inspector. The images in the 
group named "icons" have the same names as the words or phrases that 
have the link property.

I know some have complained about the RevDoc's "surprise, this is a 
link!" yellow hiliting (preferring, instead that the links be 
underlined - and I'll bet this is possible). However, in my stack, the 
process of "discovery" aids the interactivity and draws the user into 
the program. (So I like the non-obvious nature of the yellow hiliting.)

Also in the field script is the handler given in the doc's Transcript 
Cookbook (Recipe for a yellow highlight-marker effect). The hiliting 
can't be done without that script!

BTW - The two repeat loops add nothing to the length of time it takes 
to show/hide the image when compared to the "copy" and "clone" nonsense 
I had been trying earlier.

Also BTW - This script is released for use by anyone who wants to use 
it. As it's a compilation of techniques suggested by Klaus, Mark, and 
the school of hard knocks, it would be absurd for anyone to claim 
ownership.

One final question: I'd like to put this script in the stack rather 
than in each card's field (25 of them at this point). I imagine I'd 
substitute the following code in the field script:
---------------------
on mouseUp
    doTheRoutine
end mouseUp
--------------------
Then I'd rename my mouseUp handler (way above) as "doTheRoutine" and 
place it into the stack script.

Gonna have to upload an example stack of this. Thanks very much to 
Klaus & Mark (and to Rev for hosting the list).

Regards,
Barry




More information about the use-livecode mailing list