The workaround is to envelope the calculation of the button width and set the text right pos within a timer. Here is how I solved it. The _onAppearButton eventhandler ist attached to the buttons "appear" event:

   /**
    * After the button appears start recalculating and setting
    * the right pos of the text field.
    *
    * @type member
    * @param e {Event} change value event data
    * @return {void}
    */
   _onAppearButton : function(e) {
qx.client.Timer.once(this._recalculateTextPos, this, 0); },


   /**
    * Recalculate and set the right pos of the text field
    * depending on the width of the button.
    *
    * @type member
    * @param e {Event} change value event data
    * @return {void}
    */
   _recalculateTextPos : function() {
this._text.setRight(this._button.getInnerWidth() + 14); },


Dietrich Streifert schrieb:
The problem seems to be that in FF the width of the icon is not yet set correct when the appear event is fired.

In qx.ui.basic.Image there exists the method _postApply which has the following coment:

     * Internal method (called by the layout engine)
     * Applies the dimensions and then sets the source of the image instance

This method is called after the appear event is fired.


Dietrich Streifert schrieb:
Hello List,

I want to create a widget which is a qx.ui.layout.CanvasLayout which contains a text field and a button.

The button should stay at the right side of the canvas ( setRight(0) ), the text field should stay at the left side ( setLeft(0) ).

The right side of the text field should be a few pixels from the left side of the button.

The widget should be settable to left:0 and right:0 and be resizable within eg. a window.

To achieve this I need to calculate the width of the button. I tried to attach a "appear" event to the button and retreive the width via

    button.getInnerWidth();

Unfortunately this returns different widths in IE and FF.

After some investigations it turned out that the the getInnerWidth method of the icon returned 0 in FF and 16 (as expected) in IE.

Is this a bug?


Thank you for your help.

Regards.



--
Mit freundlichen Grüßen
Dietrich Streifert
--
Visionet GmbH
Firmensitz: Am Weichselgarten 7, 91058 Erlangen
Registergericht: Handelsregister Fürth, HRB 6573
Geschäftsführer: Stefan Lindner



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to