开发者

data tip in combo box

i use combo box to display a list of items. The box'x length is smaller whereas the items length is large. 开发者_StackOverflowSo if i mouse over it i need to display the whole item as a data tip.

Thanks in advance


Try this if it helps:

<?xml version="1.0" encoding="utf-8"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
    <![CDATA[
        import mx.collections.ArrayCollection;
        [Bindable]
        public var arrColl:ArrayCollection = new ArrayCollection([{data:1,label:'item1'},{data:2,label:'item2'},{data:3,label:'item3'},{data:4,label:'item4'}]);
        public function dataTipFunction():void{
          comboBoxId.dropdown.showDataTips = true;
         comboBoxId.dropdown.dataTipField = 'label';
        }
    ]]>
</mx:Script>
<mx:ComboBox x="72" y="83" id="comboBoxId" dataProvider="{arrColl}" creationComplete="dataTipFunction()" width="24">
</mx:ComboBox>
</mx:Application>


This feature is built into the Flextras AutoCompleteComboBox using our truncate to fit features. To copy the text from the product page:

The standard ComboBox will cut off the text if it is longer than the display area. You don’t get a truncation indicator. You don’t get a tooltip telling you the full text. We corrected that!

I'm pretty sure the property is named truncateToFit. Just set AutoCompleteEnabled to false and truncateToFit to true.

If your issue is with the drop down, not the "input" portion of the ComboBox, then use the commenters suggestion of adding an itemRenderer with a Label. The Flextras AutoComplete also includes a an 'expandDropDownToContent' property which will size the drop down to fit all the data, while keeping the 'input' portion smaller.

Free developer editions are available if you want to check it out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜