Flex 4 Inline Item Editor Wiping Out Data - apache-flex

In this app that has an inline item editor, if you click on a location cell then press tab, the value in the location cell is wiped out.
focusOut doesn't work, nor could I get this to work in DataGrid itemEditEnding etc.
See this Flex forums post, because posting code here rots:
http://forums.adobe.com/thread/778496

The definition for the inline item editor needs this:
selectedItem="{data.location}"
instead of this:
prompt="{data.location}"
This is because the itemEditEnd event sets the newData property (deep within the code) to the value of selectedItem, so if you have only selected the cell and have not yet selected a value in the DropDownList, such as selecting the cell then immediately tabbing out, the value gets wiped out.

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: ItemEditor losing focus!

Here's an image of what my problem is:
I am using a combo-box as a Datagrid ItemEditor (Not just Renderer, my Renderer is a Label, double clicking on a cell makes the combo-box visible, as is the case with all item editors)
Now, selecting one of the entries in the combo-box is no problem. But my problem is only when i select the "Fruit" , which in turn pops open another layer called "Select Fruit" dialog
Questions:
How do i keep item editor, while the focus is on the layer; right now as soon as i click on the fruit , my handler popsup the "Select Fruit" dialog and the focus is on the layer. Once the focus goes out of the editor, the ItemEditor goes away and ItemRenderer label comes back.
I want to keep the ItemEditor alive! where do I hook up interms of events like begin/end ItemEdit etc?
You can keep your itemEditor alive by listening for DataGridEvent.ITEM_EDIT_END. Then you have a lot more control to do what you want. Some FYI from my blog:
DataGridEvent.ITEM_EDIT_END
- Dispatched when focus is removed from the cell
- List-based control’s default event listener will
1) use the .editorDataFrield property to deterine the property of the item editor to store the edited data; In a default TextInput control’s item editor, the “text” property would contain the new data.
2) Invoke destoryItemEditor() depending on the reason of the event
You can interrupt the default List-based control’s default event listener by using event.preventDefault() to
a) Modify the data returned from the item editor
b) Examine/Validate the data entered into the item editor; If the data is incorrect, you can halt Flex passing the data back from the item editor into the list-based control
http://knowledge.lapasa.net/?p=153
Try losing focus of your ItemEditor. Goto Combo Box Change Listener
protected function comboBox_changeHandler(event:ListEvent):void
{
// set focus out event on datagrid. Its like clicking outside the datagrid
event.target.parent.parent.parent.dispatchEvent(new FocusEvent(FocusEvent.FOCUS_OUT);
}

click feature in Qt

I just want to clarify, weather the feature is present or not in Qt.
The scenario is like this,
I have a list view with items, I want to place the icon to the listview when the item is selected.
The selection I mean is, first time when I click item should be selected, next time if I click the same item then it should display some icon. Please note
It is not the double click. again if do select some other item same feature should continue
So is there any feature which handles this feature by default, any property or flag which I need to set to listview to behave like this or manual implementation
Is required for this.
No problem (: Now I understand what you mean... So if you click on an item it should be selected (for example highlighted in blue) and then when you click on this item again, an icon should be displayed.
I can't think of a regualar way to do this, there is no such flag or something.
The easiest way I can think of would be to store the index in a QList when you select it. And when you deselect it, you delete the index from the list. SO, when you click on an item you can check if it is in that list and if so you can display your icon.
Another way would be to create your own type of QModelIndex. Everytime, this index is selected, you set a bool like is_already_selected on true. When clicking on this item again you check this bool and then decide whether an icon should be displayed or not.
For further information, see: QListView, QAbstractItemView::currentIndex, QModelIndex

Flex edit DataGrid cell on click only when previously selected

I need to modify the behaviour of an editable datagrid to this:
-Single-click on a row, doesn't make the cell show a text input field (only selects the row)
-Double-click on a row, doesn't make the cell show a text input field either
but
-Clicking a cell in an already selected row, shows a text input field ready to be edited.
I belive this is how for example iTunes works.
I found a solution.
I ended up using the ListEvent.CHANGE to tell if the selectedIndex index had changed,
and then the preventDefault on ITEM_EDIT_BEGINNING if it was.

Flex ComboBox user choice reset

To be more descriptive here's a live example:
http://interklub.biz/CTPonLine.html
In last column there's a ComboBox with some values.
When user choose an option in ComboBox from first row and then scroll down the first choice disapears (comes back to default state).
There's something more strange, earlier I've tried to apply a one more ComboBox in additional column, with highly dynamic values (completly different for different rows), but with after same action (scroll down and then scroll down) values dataProviders from different ComboBox were switch.
It looks like you're not initializing your item renderer properly--when the renderer is reused, it's keeping its old value rather than updating from your data.
You should be able to resolve this by doing one of the following:
binding the item renderer's selectedValue to some property of its data element
overriding set data() to update the control for the current data
acting on the dataChange event and updating there
See Adobe's Working with Item Renderers for more.

Resources