You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/03/05 12:46:03 UTC
[royale-asjs] branch develop updated: jewel-combobox: fix percent
width
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 369f699 jewel-combobox: fix percent width
369f699 is described below
commit 369f699b50e1ba3eab100724a68089b8bc44e63a
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Thu Mar 5 13:45:50 2020 +0100
jewel-combobox: fix percent width
---
.../royale/jewel/beads/views/ComboBoxView.as | 41 ++++++----------------
1 file changed, 10 insertions(+), 31 deletions(-)
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxView.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxView.as
index d4711ba..93861cc 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxView.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxView.as
@@ -31,6 +31,7 @@ package org.apache.royale.jewel.beads.views
}
import org.apache.royale.core.BeadViewBase;
import org.apache.royale.core.IComboBoxModel;
+ import org.apache.royale.core.ILayoutChild;
import org.apache.royale.core.IParent;
import org.apache.royale.core.IStrand;
import org.apache.royale.core.ValuesManager;
@@ -149,8 +150,6 @@ package org.apache.royale.jewel.beads.views
}
model.addEventListener("selectionChanged", handleItemChange);
model.addEventListener("dataProviderChanged", itemChangeAction);
-
- listenOnStrand("sizeChanged", handleSizeChange);
}
private var model:IComboBoxModel;
@@ -246,14 +245,6 @@ package org.apache.royale.jewel.beads.views
}
}
- /**
- * @private
- */
- protected function handleSizeChange(event:Event):void
- {
- sizeChangeAction();
- }
-
/**
* @private
*/
@@ -272,39 +263,27 @@ package org.apache.royale.jewel.beads.views
_textinput.text = getLabelFromData(model, model.selectedItem);
}
+ public static const DEFAULT_BUTTON_WIDTH:Number = 38;
+
/**
* Size the component at start up
*
* @private
*/
protected function initSize():void
- {
- _button.width = 39;
+ {
+ _button.width = DEFAULT_BUTTON_WIDTH;
- if(host.width == 0 || host.width < 89)
- {
- var w:Number = host.width == 0 ? 200 : 89;
- _textinput.width = w - _button.width;
- host.width = _textinput.width + _button.width;
- } else
- {
- _textinput.width = host.width - _button.width;
- }
+ var cmb:ILayoutChild = host as ILayoutChild;
+ // if no width (neither px or %), set default width
+ if(cmb.isWidthSizedToContent())
+ cmb.width = 200;
+
_textinput.percentWidth = 100;
}
/**
- * Manages the resize of the component
- *
- * @private
- */
- protected function sizeChangeAction():void
- {
- host.width = _textinput.width + _button.width;
- }
-
- /**
* Adapt the popup list to the right position taking into account
* if we are in DESKTOP/TABLET screen size or in PHONE screen size
*