use-revolution Digest, Vol 12, Issue 17

Cubist at aol.com Cubist at aol.com
Fri Sep 3 15:34:32 EDT 2004


In a message dated 9/3/04 11:02:47 AM, 
use-revolution-request at lists.runrev.com writes:

>
>
>Message: 11
>Date: Fri, 3 Sep 2004 13:01:26 -0400
>From: "Frank D. Engel, Jr." <fde101 at fjrhome.net>
>Subject: unhilite all fields of card ... ?
>To: How to use Revolution <use-revolution at lists.runrev.com>
>Message-ID: <E4B7E742-FDCA-11D8-9052-0050E4BA750F at fjrhome.net>
>Content-Type: text/plain; charset=US-ASCII; format=flowed
>
>If anyone happens to know a convenient Transcript shortcut for 
>"unhilite all button on card x", "unhilite all buttons on cards a, b, 
>and c", and/or for "put empty into fields x, y, z, and t", it would 
>certainly save me a lot of time typing in some of these scripts...   
>I'm having to "unhilite button x of card a", "unhilite button y of card
>
>a", "put empty into field z of card a" for several hundred lines in 
>each of several scripts for this project I am doing.
   The answer is to put a handler like this into the script of the stack (so 
that it can be called from *any* card in the stack):

on LightsOut CardName
  lock screen # this is optional, depending on how many buttons you're gonna 
unhilite
  repeat with K1 = 1 to the number of buttons on card CardName
    set the hilite of button K1 of card CardName to false
  end repeat
  unlock screen # again, optional, depending on the number of buttons
end LightsOut

   Any time you want to unhilite an entire card's worth of buttons, just put 
one line -- "LightsOut (the short name of this card)" -- into the handler 
that's doing the unhiliting. If you want to play with multiple cards, something 
like this would be useful:

on LightsOut CardNameList # comma-delimited list of card names
  lock screen # this is optional, depending on how many buttons you're gonna 
unhilite
  repeat for each item CN of CardNameList
    repeat with K1 = 1 to the number of buttons on card CN
      set the hilite of button K1 of card CN to false
    end repeat
  end repeat
  unlock screen # again, optional, depending on the number of buttons affected
end LightsOut

   The analogous handler(s) for clearing the contents of text fields are left 
as an exercise for the reader.

   Hope this helps...


More information about the use-livecode mailing list