Combobox, word wraps and variable heights


i trying make combo box variable height items have managed writing this:

<combobox:mccombobox
            id="combobox"
            prompt="{_prompt}"
            maxwidth="{container.width}" 
            itemrenderer="{new classfactory(mccomboboxitemrenderer)}"
            dataprovider="{_dataprovider}"
            change="_updateanswervo(event)"
            open="_opencomboboxhandler(event)"/>

private function _opencomboboxhandler(e:dropdownevent):void {
                var list:list = e.currenttarget.dropdown
                list.wordwrap = true;
                list.variablerowheight = true;
                list.height = list.measureheightofitems();
            }

 

this being displayed properly.  minor glitches positioning , height of dropdown.

 

the problem displaying selected item

i've created custom combo box uses item renderer class display instead of textinput

 

protected var textinputreplacement:uicomponent;
           
            override public function set itemrenderer(value:ifactory):void {
                super.itemrenderer = value;
                createchildren();
            }
            override protected function createchildren():void {
                super.createchildren();
               
                if ( !textinputreplacement ) {
                    if ( itemrenderer != null ) {
                        //remove default textinput
                        removechild(textinput);
                       
                        //create new itemrenderer use in place of text input
                        textinputreplacement = itemrenderer.newinstance();
                        textinputreplacement.mouseenabled = textinputreplacement.mousechildren = false;
                        bindingutils.bindproperty(textinputreplacement, "data", this, "selecteditem", true);
                        addchild(textinputreplacement);
                    }
                }
            }
            override public function set prompt(value:string):void {
                super.prompt = value;
            }
            override protected function updatedisplaylist(unscaledwidth:number, unscaledheight:number):void {
                super.updatedisplaylist(unscaledwidth, unscaledheight);
               
                if ( textinputreplacement ) {
                    textinputreplacement.width = unscaledwidth;
                    textinputreplacement.height = unscaledheight;
                }
            }
            override public function set selectedindex(value:int):void {
                super.selectedindex = value;
                if (textinputreplacement && textinputreplacement.height)
                    height = textinputreplacement.height;
            }

 

the problem can't height of combobox adjust based on selected answer since seems fixed height, how can set actual itemrenderer's height , not container's?

is flex 4?  may have set variablerowheight=true on dropdown

in skin.



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Hur installera Joomla på One.com - Joomla! Forum - community, help and support

removing index.php from URL address - Joomla! Forum - community, help and support

「イメージマップのアンカー名には、...」のエラーが出ないようにしたい