Point of confusion - Custom Properties

Mark Schonewille m.schonewille at economy-x-talk.com
Thu Apr 27 05:49:46 EDT 2006


You are right, Phil. The following two examples do exactly the same:


example a)

on mouseUp
   beeper 2
end mouseUp

on beeper x
   beep x
end beeper


example b)

on mouseUp
   set the beeper of this stack to 2
end mouseUp

setprop beeper x
   beep x
end beeper


There really is no difference between the getprop/setprop handlers  
and commands and functions in this respect. The only difference is in  
the way they return a value. Commands return a value in "the result",  
functions in "it" and getprop/setprop handlers in a property.

If there is no getprop/setprop handler to catch the message,  
Revolution will return the value to or from the specified property.  
If there is such a handler, the handler may return the value or pass  
the message on to Revolution. If the message is passed on, Revolution  
returns the value.

Thus, Jim's original approach was correct. You can use setprop  
handler to check a value before a property is changed:

setprop someProperty theValue
   if theValue is "the correct value" then
     pass someProperty
   end if
end someProperty

Is this still confusing?

Best,

Mark




--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Salery is the easiest way to set up your own web store: http:// 
www.salery.biz/salery.html


Op 27-apr-2006, om 7:13 heeft Phil Davis het volgende geschreven:
>
> I believe they work the same way 'closeCard', 'preOpenCard' and  
> 'openCard' messages work when your script says 'go next card'.  
> Those messages are fired *during* the execution of your 'go'  
> command, and any like-named handlers in the path will complete  
> before the 'go' command completes. The messages are an inherent  
> part of doing the command, and they are fired at specific points  
> during execution of the command; any handling of those messages  
> will pause the command that fired them until handling is complete;  
> then control is returned to the original command (e.g. 'go'), and  
> it continues on its way.
>
> Am I answering what you're asking, Jim?
>
> Phil



More information about the use-livecode mailing list