Insert into back script logic

Mark Smith mark at maseurope.net
Sat Apr 1 06:07:36 EST 2006


I tried this

In script of cd
  on putSomething
   put "Hi There" & cr after msg
end putSomething

I then inserted the card script into back.

Now, in a button on the card:
on mouseUp
   put empty -- to clear the meassge box
   putSomething
end mouseUp

clicking the btn produced one "Hi There" in the message box.

in another button:
on mouseUp
  put empty
  send "putSomething" to this cd
end up

also produced one "Hi There" in the message box



Now I changed the card script to
  on putSomething
   put "Hi There" & cr after msg
   pass putSomething
end putSomething

Now,
send "putSomething" to this cd
produced two "Hi There"s in the message box

and
putSomething
produced two "Hi There"s, but also got a "putSomething: can't find  
handler" error

I think that this suggests that the message will go to the card  
itself first, and be trapped there, and will go on to the backscript  
only if explicitly passed.
I can't see why the send form produces no error, but the direct form  
does, but this is only if the message is explicitly passed, so  
probably not a problem.

Best,

Mark

On 1 Apr 2006, at 03:23, Sarah Reichelt wrote:

>> I am asking this time since I don't have a moment to spare before  
>> Sat AM.
>>
>> I want to implement a design change into a rather complex program  
>> that uses
>> one card in one stack.
>>
>> The question:
>> Does the following
>>     insert the script of this card into back
>>
>> mean that the card script at the card level will also be in the  
>> hierarchy
>> trapping messages as well as in the back, or
>>
>> by inserting it into the back, this becomes its one-and-only  
>> position?
>>
>> If there is a send "sumptin" to card 1, does this trigger twice?
>
> Hi Jim,
>
> I don't know for sure, but I would be worried that your card handlers
> might be triggered twice. I would recommend putting them into a
> separate button and inserting the button's script into back. That way
> you can be sure it is only in the hierarchy once.
>
> Cheers,
> Sarah
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list