PDA

View Full Version : IlvScrolledComboBox::insertLabe() error with same data



Flows
11-28-2013, 04:51 AM
Hi,

I need to insert in a combo box two labels at the top of the list. The combo box is not empty before my insertion.
For these labels, I do not specify any data. As a consequence, data are the same for both labels. When I call the function whichSelected(), it returns -1 instead of 0 or 1 (my labels are at the top of the combo box list).

I tried to figured out how to find a solution of my issue but I didn't succeed. If I insert only one label, it works how it should.

Do you know if it as a normal behavior and/or how to correct it ?

Here is the the flow I use
Init function


ComboBox->insertLabel(0,"label1");
ComboBox->insertLabel(0,"label2");


When I click on a label in the combo (user side), a callback is called


IlShort idx = ComboBox->whichSelected();
//work using idx
//But in my case, idx=-1 if label1 or label2 is selected


Thanks a lot

Note:
I am using Version 5.5

cmartin
11-28-2013, 07:03 AM
Hello Flows,
Not sure I get you right. May be a more thorough description of the sequence you use may help.

On first sight, the normal behavior is:
- inserting or adding one or label remove the current selection
- thus calling whichSelected after an insertion should return -1 (as documented).

Flows
11-28-2013, 07:32 AM
When I add the label, I don't care of the current selection, so the first behavior you highlight is fine for me.
Then, on the application/user side, when I select an item of the combo, a callback is called. In the callback, I need to use whichSelected().

When you write
" - thus calling whichSelected after an insertion should return -1 (as documented)."
Do you mean straight after the insertLabel() ? It is not what I do. I updated original post with example.

Flows
12-04-2013, 12:20 AM
Found the solution in my code.