EmCombo subclass - example

I made a specialization of AW.UI.Combo that uses em units.
It nicely computes sizes for the combo, combo box, and items.
It grows with Ctrl++ (event.keycode == 107) and shrinks with Ctrl+- (event.keycode==109). Note that if the popup is shown when the user augment or diminish the font size, it is feasible to reposition the popup window by capturing the event on the window object...). Anyway the only issue I have is with shrinking the <b>.aw-combo-box .aw-item-box</b> does not shrink - What is it that I missed?

EmCombo = AW.UI.Combo.subclass();
EmCombo.create = function(){

this.prototype.fixEmSize = function() {
var n = this.getItemCount();
var tb= this.getItemText();
var tb= new Array();
for (var i=0;i<n;i++) tb[i]= this.getItemText(i).length;
var mx= Math.max.apply( Math, tb );
var w= 4 + (mx*0,7);
var h= 2 ;
this.setStyle("width" ,w +"em");
this.setStyle("height",h +"em");
var tpl= this.getItemTemplate();
tpl.setStyle("height",h +"em");
tpl= this.getPopupTemplate();
tpl.setStyle("height",((h+0.1)*n) + "em");
tpl.setStyle("width",w + "em");
var oo= new EmCombo;
oo.setControlText("Some text");
oo.setItemText(["Home", "Favorites", "Font size", "Search"]);
oo.setItemImage(["home", "favorites", "fontsize", "search"]);
Philippe Marzin
March 12,
Inner box element is normally set to 100% width and height, so it should expand with the parent element.
Alex (ActiveWidgets)
March 13,
It expands wonderfully (by the way it's 0.7 not 0,7, it's 0.33 and not 0.1 and these numbers varies for doctypes, they are just approximative anyway).
But it does not shrink correctly due to the

To see what the problem is take the combo.htm example in the 2.5.1 and use the style #myCombo {width: 10em; height: 1.2em}, then do twice Ctr+ and twice back Ctrl-

I made the same for AW.UI.Input and it works, it 's due to the table class="aw-combo-button". I was hoping to get a fix, anything I should do on receiving the event?
Philippe Marzin
March 13,

This topic is archived.

See also:

Back to support forum