Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2018-10

Combobox with sorted list of unique items?

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

I am trying to use a combobox as a container for recently used IP addresses for easy selection by the user.
I can set the combobox style to csDropDown and Sorted to true. But I cannot find the duplicates setting so I can set it to unique...

Is there some other way to do this except by loading the data on startup into a TStringList with sorted and unique set and then transfer the content into the Combobox?

Bo Berglund Developer in Sweden

Reply by email

Vojtěch Čihák

I just tried TStringList(ComboBox1.Items).Duplicates:=dupIgnore; but it does not work for combo (in Qt4).  
V.
______________________________________________________________

Show quoted text 5 lines
Od: "Bo Berglund via Lazarus" Komu: Datum: 12.10.2018 13:22 Předmět: [Lazarus] Combobox with sorted list of unique items?

I am trying to use a combobox as a container for recently used IP addresses for easy selection by the user.
I can set the combobox style to csDropDown and Sorted to true. But I cannot find the duplicates setting so I can set it to unique...

Is there some other way to do this except by loading the data on startup into a TStringList with sorted and unique set and then transfer the content into the Combobox?

Bo Berglund Developer in Sweden --

Reply by email

Bo Berglund
to Bart
Bart wrote 7 lines
On Fri, Oct 12, 2018 at 2:30 PM Vojt?ch ?ihák via Lazarus wrote: > > I just tried TStringList(ComboBox1.Items).Duplicates:=dupIgnore; but it does not work for combo (in Qt4). Override Insert and check if it is already in there?

It is going to be simpler to just use a TStringList container while reading from the ini file because it can be set for sorted and dupignore.
Then at the end just assign the stringlist to the combobox text property.

combobox.items.text := stringlist.text;
Bo Berglund Developer in Sweden

Reply by email