Is there any way of hooking the setter generated by defineProperty() to executing some additional code other than setting the value of the property. I know I can write the setter/getter manually, just wondering whether there was a clever way.
Thursday, December 1, 2005
I suggest (if you havent gotten past this, which I suspect you have), that you create custom methods of your control to set/get your new property without trying to modify the newly generated methods. Less room for failure. If you did find a way to modify the generated setter/getter then I would like to hear about it.
Jim Hunter (www.FriendsOfAW.com)
Friday, February 10, 2006
Each generated setter includes raises two events - ...Changing and ...Changed, for example for text property of the cell model those are -
// before the change
onCellTextChanging(text, col, row);
//after the change
onCellTextChanged(text, col, row);
The events could be used to perform additional actions when a setter (for example, setCellText()) method is called. It is possible also to cancel assignment if non-zero value is returned from ...Changing() event handler.
Monday, February 13, 2006
It would appear that this is true for controls, but not for models?
Tuesday, February 14, 2006
Sorry - allow me to clarify that previous post.
For a control, such as a AW.UI.Grid, if I define a model with properties, then setting values to the model properties raises the on...Changing and on...Changed events. This is what Alex (ActiveWidgets) said.
For an external mode, as might be used with a Grid, then the a property created with defineProperty() does not raises these events.