TGComboBox doesn't show proper selected/highlighted entry

Good morning Rooters,

In my root gui app (root 5.24, both windows and linux), it’s possible for the user to highlight an entry in a TGComboBox, then move the cursor to a different control, and this results in the selected entry not being displayed.

In trying to come up with a short test case for you, I was able to produce a very similar problem with the calendar.C example in tutorials/gui . Start calendar, click on the pull-down arrow on the ‘Date:’ combobox and click on march; march is displayed in the date field and the march calendar is displayed. Click the up or down arrow on the year entry, and you see the march calendar for the proper year.

Now click on the pull-down arrow on the ‘Date:’ field again, move the mouse pointer to the june entry, which becomes highlighted (blue background), do NOT click on the entry, but move the mouse cursor to the year field and click on the year field. (The date combobox still shows march). Click the up or down arrow on the year field, and you get the JUNE calendar for that year, not the march calendar, which is what the user would expect.

I can’t enforce that my users always click on an entry to select it; sometimes they just highlight it (either via mouse or arrow keys), and then move on to some other field.

What is a good fix to make sure the entry displayed in the comboxbox is the selected entry? Is there a way to detect when the combobox loses focus? Or perhaps some code to detect this condition, then I could take some recovery action.

Also, in my application, I do not use Connect() and signals; I use ProcessMessage() on the TGMainFrame to detect and respond to events.

Thanks very much for your help,
Buddy

Hi Buddy,

I will investigate, thanks for reporting it.
And the standard behaviour is to actually click in a combo box to select the entry (and this is the way I will fix it)

Cheers, Bertrand.

Hi,

This issue has been fixed in the trunk. Now the user has to select the entry by clicking on it. If the combo box is closed by clicking outside, the selected entry doesn’t change anymore. Thanks for the report.

Cheers, Bertrand.

Thanks Bertrand,

I’ve incorporated the code from the trunk and it does fix my problem.

Buddy

Hi Buddy,

Very good! And you’re welcome. Thanks to you for the feedback! :slight_smile:

Cheers, Bertrand.