On 10/04/2011 05:50 PM, Seldaiendil D. Flourite wrote:

    Hi all,


Time ago I tried to inherit from *qx.ui.form.TextField* to create a search field with the magnifier icon. The DOM structure I wanted was like this:

    - Container DIV
      - Decorator
      - Content DIV
        - TextField INPUT
        - Icon IMG


But it was impossible, *qx.ui.form.AbstractField* (base of *qx.ui.form.TextField*) uses the INPUT as content element. It's ok, it saves one DOM element, this is not the problem, the problem is that each time it needs to access the INPUT element it uses the method "*getContentElement()*":

    qx/ui/form/AbstractField.js : 66 - Constructor
       this.*getContentElement*().addListener(
          "change", this._onChangeContent, this
        ); ...


So, as my intention was to overwrite the content element with a DIV containing the image I have to overwrite all this methods, many of them aren't just a few lines. My question is: if I need to access the input element I will access the input element, why sould you call *getContentElement* and expect the content element to be the input? Why not to store the input in a private (or better, protected) member and use the *getContentElement* to those actions who really needs to be applied over the content element?

I didn't found a easy way to inherit from input and overwrite the content element so I was forced to inherit from widget containing the *qx.ui.form.TextField* as child control and create wrappers for each *qx.ui.form.TextField* method.

In my view, you are using qooxdoo against its fur. Rather than breaking up the TextField widget, because you have a certain COM structure in mind, you should leave that to qooxdoo and think on the level of composing widgets. You could create your own text field widget that uses a horizontal layout to embed the TextField and the Icon widgets. Then add a method like getValue to your custom widget and call this.textfield.getValue in there (assuming this.textfield is the TextField child widget).

T.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to