When is message passing required?
Peter M. Brigham
pmbrig at gmail.com
Mon May 23 12:15:02 EDT 2016
On May 23, 2016, at 11:03 AM, Kay C Lan wrote:
> On Mon, May 23, 2016 at 9:13 PM, Paul Dupuis <paul at researchware.com> wrote:
>
>> In some dictionary entries, like for rawKeyDown, it talks about the need
>> to pass the message (unless you want to trap all key presses).
>
> The Dictionary entry for 'pass' also mentions the need to pass
> 'setprop' if you have custom properties that are set via setprop
> handlers.
Although, there is the well-known technique of deliberately not passing a get/setprop message, turning the property into a "virtual property" -- so actions are taken but no custom property of any object is actually set. For instance:
getprop writable
---- a virtual field property ----
-- writable = true if locktext = false, traversalon = true, autohilite = true
-- ie, user can enter text
if not (the target begins with "field") then return empty
put the locktext of the target into L
put the traversalon of the target into T
put the autohilite of the target into A
if T and A and not L then return true
return false
end writable
setprop writable tf
---- a virtual field property ----
-- writable = true: set locktext = false, traversalon = true, autohilite = true
-- ie, user can enter text
-- writable = false: set locktext = true, traversalon = false, autohilite = false
if not (the target begins with "field") then exit writable
set the locktext of the target to not tf
set the traversalon of the target to tf
set the autohilite of the target to tf
end writable
-- Peter
Peter M. Brigham
pmbrig at gmail.com
More information about the use-livecode
mailing list