Flex3 Combobox doesn't display itemRenderer when closed - apache-flex

I have a combobox with a custom itemRenderer. The ItemRenderer displays some images and a label.
When the combobox opens, the items in the dropdown list display perfectly, but when its closed, the combobox doesn't use the ItemRendere, but shows "[object MyItem]". Do I need another attribute to indicate that the ItemRender also needs to be used when closed?
This is my tag:
<mx:ComboBox dataProvider="{myItems}" id="itemsCombo" itemRenderer="org.test.myComboBoxItemRenderer" />

you need to set the labelField or labelFunction property on the combobox to show the same thing as your itemrenderer.

Related

How to set display text for ComboBox (checkable) in Qt

I follow these to create checkable combobox
ComboBox of CheckBoxes?
http://programmingexamples.net/wiki/Qt/ModelView/ComboBoxOfCheckBoxes
However when I do a this->Model->clear() then add items, the combobox text (the text combobox displays before user clicking anything) goes blank. The items will still show and are checkable when click on the combobox. I suspect the clear() remove the header and causes this, however I try setHorizontalHeaderLabels etc but I still can't set the combobox text. What am I missing?
Try setting the ComboBox's selected index after you add items. Like:
ui->combobox->setCurrentIndex(0);
Because it could be that after you clear the ComboBox, its display index may have gone to -1 and stayed there even if you add items.

Flex Combobox and DateField Weird Bug

Using Flex 4.1 Build 16076
I have an mxml file, containing a textinput, a button, a datefield and a combobox.
The data provider for the combobox is an arraycollection.
When the flex application is started, the combobox's dropdownlist shows up fine. The calendar also displays when clicking on the calendar icon on the datefield.
Now when I click on the button which displays a popup window, and get the data from there and put it back on the textinput, combobox (select the item) and datefield, the combobox and the datefield does not show the dropdownlist and the calendar respectively.
I am not changing the data on datasource on the combobox. Merely selecting the item based on what was retrieved from popup window.
This one is really stumping me. Seems that the datefield and combobox does not respond to mouseevent. When the focus is on the combobox, I could still use the keyboard to change the values displayed, but the dropdownlist still does not show.
Has anyone encountered this behavior?
The resolution to this issue was to update the FlashPlayer to the latest version in Chrome.

Flex 3: TextInput as ItemRenderer for CheckBox in ComboBox?

I need to create a Flex component similar to ComboCheck (by Arcadio Carballares).
What I need is a ComboBox with CheckBox and TextInput instead of Checkbox's label.
If CheckBox is selected the TextInput is enabled and editable, other way it's disabled.
Do you have an idea of the easiest way to achieve it?
Create an itemRenderer containing the check box and text input (and code to toggle the editable/enabled prop on the text input), and use that in your combo box as itemRenderer.

Setting a custom itemRenderer in a Flex3 ComboBox on specific list items after combobox creation

I'm trying to set a specific list item in a mx combobox to have a custom item renderer, the problem is that I cannot do this via mxml, it needs to be done via actionscript at a later stage, eg: combobox gets created, combobox gets populated, user does other tasks, combobox needs to set one or more items in the combobox to have icons (via item renderer)..
I can do this via the onChange event, but it only applies the icon when the combobox is opened and there is a slight delay so you can see the icon being added.
Thanks in advance for any help
J
The normal answer for this is to not do this in the onChange, but to change something in the ComboBox's dataProvider and let the itemRenderer handle it instead.
i.e. in the itemRenderer
<mx:Image id="icon" source={data.icon} visible={data.icon} includeInLayout={data.icon} />
Setting the icon property in whichever item you want to show the icon for. If icon is null, nothing gets shown.

Flex Combobox: Cancel Select

I've made an itemrenderer for the combobox control that shows a button next to the label.
If a user clicks this button, the item gets removed from the dataprovider. Works so far.
When he selects an item, the combobox closes, that's ok. But I don't want it to close when he removes an item.
So is there a way to cancel the change event?
I have tried several things, but to no avail.
I have to use the combobox for layout reasons, don't have enough space to use listboxes...
Thanks for your help.
In your custom itemrenderer , on mouse down handler stop Immediate Propogation
event.stopImmediatePropogation();
In your custom item renderer, try canceling the event in your button's click handler.
event.stopImmediatePropogation()

Resources