Making a ComboBox only show ToolTips for Long Items

I had a Flex Combobox that had contents too big to fit, but when I made it shorter to fit, the items would be cut off. There’s a brilliant solution on the FlexExamples site that handles it so:

<mx:ComboBox id="projectComboBox"
             dataProvider="{projectList}"
             maxWidth="400"
             itemRenderer="mx.controls.Label"/>

All this does is specify the use of a label control as the TextField in the ComboBox. Since Labels are made to truncate then produce tooltips automatically, this is amazingly simple.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">