[REBOL] Re: object/property1: "new value"
From: dockimbel:free at: 30-Jan-2001 16:21
Hi Helmut,
[...]
> I want to get a "fire" -event if an attribute, such as 'balance, is
> changed. So I can test of a valid data-type or to test wether the new value
> is in a valid range.
Define a 'set-balance (or 'let-balance) function in the account context, where
you can put all your processing code. For example :
account: make object! [
balance: $100
set-balance: func [value][
...process value and assign 'balance to value if ok...
]
...
]
So, when you want to modify 'balance somewhere in your script do :
set-balance value
instead of
balance: value
In VisualBasic, it's the same thing except that VB will automatically call the
Let property when it encounters a "=" symbol.
If you don't like this solution, you can try another way by using the 'query
function. For example,
query/clear account
will return you a block of modified words in 'account (else 'none). With this
function, you can know what words have been modified in an object context and
then do the appropriate actions.
HTH,
DocKimbel.