Howdy!

> 1. You path the qooxdoo class qx.ui.form.AbstractField by adding this
> to the members section:
> 
> 
>     /**
>      * Resets the value to the default
>      */
>     resetValue : function() {
>       this.setValue("");
>     },
> 
> 
> 2. You use an evil JavaScript trick to patch the class from your own
> code:
> 
> 
>       // patch the textfield
>       qx.ui.form.TextField.prototype.resetValue = function() {
>        this.setValue(""); 
>       }
> 
> 
> I would prefer option one because is a much nicer solution. And if you
> upgrade to the next release, exactly these lines will come in
> automatically. 

Actually, I would suggest option 1b  ;-)

There's a "cleaner" way in qooxdoo to explicitly patch existing classes.
I would not alter/augment existing code to limit future update
conflicts.

See the API viewer for qx.Class.patch() . You create a mixin that comes
with the method to override. You could for instance call patch() in the
defer section of your main application class. Once your patches are
superseded by a future qooxdoo release, you can remove your patches.

BTW, when just augmenting existing code in other scenarios, use
qx.Class.include() instead, which is not allowed to override existing
code (and therefore avoids conflicts).

HTH,

Andreas






------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to