[Lazarus] Combobox with sorted list of unique items?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Combobox with sorted list of unique items?

Free Pascal - Lazarus mailing list
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

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Combobox with sorted list of unique items?

vojtech.cihak

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

 

V.

______________________________________________________________
> Od: "Bo Berglund via Lazarus" <[hidden email]>
> Komu: [hidden email]
> 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

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Combobox with sorted list of unique items?

Free Pascal - Lazarus mailing list
On Fri, Oct 12, 2018 at 2:30 PM Vojtěch Čihák via Lazarus
<[hidden email]> 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?

Bart
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Combobox with sorted list of unique items?

Free Pascal - Lazarus mailing list
On Fri, 12 Oct 2018 15:30:52 +0200, Bart via Lazarus
<[hidden email]> wrote:

>On Fri, Oct 12, 2018 at 2:30 PM Vojt?ch ?ihák via Lazarus
><[hidden email]> 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

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Combobox with sorted list of unique items?

Free Pascal - Lazarus mailing list
On Fri, Oct 12, 2018 at 5:01 PM Bo Berglund via Lazarus
<[hidden email]> wrote:

> combobox.items.text := stringlist.text;

combobox.items.assign(stringlist)?

--
Bart
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus