UI component openCard/preOpenCard

Alex Tweedly alex at tweedly.net
Thu Jul 15 13:20:08 EDT 2004


At 09:36 15/07/2004 -0700, Rob Cozens wrote:

>>>  How might these components receive these calls?
>>
>>The preOpenCard & openCard messages are sent to the card;
>
>In card or higher script:
>
>on preOpenCard
>    get the number of controls of the target
>    repeat with x = 1 to it
>      send "preOpenCard" to control it
>    end repeat
>end preOpenCard
>
>Note that each control MUST contain a preOpenCard handler or the message 
>will be passed up to the card...and processing should loop until RAM is 
>exhausted.


Couldn't you check that for a loop ?

on preOpenCard
   if target is not me then exit preOpenCard   - in case any control failed 
to have a handler
   get the number of controls of the target
   repeat with x = 1 to it
     send "preOpenCard" to control x
   end repeat
end preOpenCard

>A better solution would be to pass the controls a different message, eg: 
>cardPreOpen, rather than using system messages usually targeted to higher 
>objects.

That would be better.
-- Alex.
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004


More information about the use-livecode mailing list