ComboBox ListIndex is -1 when I change its text contents (in Change)

Hi all,

First: a simple explanation about how I use this ComboBox

I have a simple window that deals with a bunch (less than 20) Caritative Association (display Name, Address, Phone, eMail and Boss).

I choosed to place the Caritative Association name in a ComboBox vs a PopupMenu because I feel it is better for adding / changing the Caritative Association name (+ other Properties), later (in case or error or any other error).

I have a bunch of buttons to Delete, Modify or / and Add a New Record (Caritative Association).

I stored the Record nique ID in the ComboBox RowTag.

In the Modify button, I take the ComboBox’s Selected Row # to take back the UniqueID (for obvious reasons).

But, ListIndex is always-1.
My feeling is … that information (ListIndex) is set to -1 when the user change the Text property contents.

Were you in this case ? If so, what was your strategy to get the original ListIndex value ?

This also goes to Delete (but I do not care about Add a Record: no Unique ID needed).

No, I was not. But I would expect it to be -1 because as soon as I change the content, it’s no longer an item of the “stored” items.
I would store the selected RowTag somewhere else and reuse it when the modify Button is doing it’s thing.

Edit: I’m not really awake. I forgot to THANK you Sascha for your help.

That is my conclusion :frowning:

I woke up earlier this night and was thinking: “Why mimick the Listbox Control ? Because it is possible ? But if this does not works as I intended, I have to use a Workaround

In a subsequent woke up, I think: “Emile: add a Read/Only TextField, populate it at the time you populate the other fields and use it at Delete or Modify (Update) time !”

I will try that idea in an hour when I will be at my local McDonald’s ;).

In the same “woke-up session”, the words of an old George Harrison (The Beatles) comes to mind: Taxman.
When you want to do something [Chorus: Xojo’s Work-around !]
When you want to do something else [Chorus: Xojo’s Work-around !]

I hope your face now wears a small smile and…

Remember: Smile is only one letter away from Emile…

Hi all,

I was not fully awaken (in my previous text, above).

Now I understand why I was astounished by the ComboBox strange behavior. It was easier (and Listbox looking programmation) to follow that path.

As I wrote above, at ComboBox Selection of an entry time, I set the Unique ID in a ReadOnly TextField and will use it to Modify or Delete the displayed Record. I already wrote the “load and display” part and it worked fine…