Need to build wxComboBox with ~15,000 entries

Hi all,

I need to build a wxComboBox with ~15,000 entries. The problem is that on
the way to ~15,000 entries the GUI stops reacting for a while. I want to get
rid of the "for a while" thing. I tried to build a simple list with ~15,000
and then pass it to the wxComboBox ctor. I tried to init the wxComboBox with
an empty list, and then add the entries in a for loop. I tried to do the
task using a thread, that adds tha entries in a for loop to the wxComboBox
(via wxCallAfter() call). All these work, but nothing works as I would like
it to work.

Thanks in advance,
Ilia Kats

Why would you put so many entries in a ComboBox ? How would someone scroll and
select the entry he wants if there are 15,000 of them ? Specially on GTK this
would look ugly. The combobox would extend to the end of the screen and you'd
have to scroll way down, since there is no autocompletion thing like windows
has.
Looks to me like you're doing the classic MS Access approach - aka load all
records from the db into the combo widget to have the user select the record.
Wouldn't it be a better approach to make some kind of subselection __before__
filling the remainder into the combobox ? Doing so would eliminate the need
to fill so many values into the combobox
Just a thought.....

  UC

···

On Wednesday 18 June 2003 01:00 am, Ilia Kats wrote:

Hi all,

I need to build a wxComboBox with ~15,000 entries. The problem is that on
the way to ~15,000 entries the GUI stops reacting for a while. I want to
get rid of the "for a while" thing. I tried to build a simple list with
~15,000 and then pass it to the wxComboBox ctor. I tried to init the
wxComboBox with an empty list, and then add the entries in a for loop. I
tried to do the task using a thread, that adds tha entries in a for loop to
the wxComboBox (via wxCallAfter() call). All these work, but nothing works
as I would like it to work.

--
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417

Ilia Kats wrote:

Hi all,

I need to build a wxComboBox with ~15,000 entries.

You really don't want to do that. The combobox UI was really only designed to give a choice of a few tens of items, the GTK 1.x combobox will start failing aound 2000 items, and most users on any platform can only easily deal with a few hundred items at most.

A possible alternative UI is a virtual wxListCtrl. Then you won't have to go thought a time consuming data loading step since the control asks you for the data when it needs to display it. A nice addition to that is a wxTextCtrl that acts as a filter so as the user types something reduce the items shown in the listctrl by reducing the dataset and calling RefreshItems.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

I already wrote:

Hi all,

I need to build a wxComboBox with ~15,000 entries.

Robin and Uwe,
you are both right! I need to change the current approach and make some
filtering before filling up the desired control. It makes no sense to build
a wxComboBox with ~15,000 entries.

Thanks
Ilia Kats

Uwe C. Schroeder wrote:

Hi all,

I need to build a wxComboBox with ~15,000 entries. The problem is that on
the way to ~15,000 entries the GUI stops reacting for a while. I want to
get rid of the "for a while" thing. I tried to build a simple list with
~15,000 and then pass it to the wxComboBox ctor. I tried to init the
wxComboBox with an empty list, and then add the entries in a for loop. I
tried to do the task using a thread, that adds tha entries in a for loop to
the wxComboBox (via wxCallAfter() call). All these work, but nothing works
as I would like it to work.
   
Why would you put so many entries in a ComboBox ? How would someone scroll and select the entry he wants if there are 15,000 of them ? Specially on GTK this would look ugly. The combobox would extend to the end of the screen and you'd have to scroll way down, since there is no autocompletion thing like windows has.
Looks to me like you're doing the classic MS Access approach - aka load all records from the db into the combo widget to have the user select the record.
Wouldn't it be a better approach to make some kind of subselection __before__ filling the remainder into the combobox ? Doing so would eliminate the need to fill so many values into the combobox
Just a thought.....

I have a similar problem to Ilia, but I am going the virtual listctrl route, however I am a bit stuck on how to emulate the autocomplition. I am thinking to have a search field below/above the listctrl, but can't figure out a way to use that field and search in something.

Currently I have a dictionary indexed by item number (required to be able to do the cacheHint stuff), this list gets cleared at some point (to save memory), then I have a list where the possition in the list is equal to the possition in the listctrl and it contains sub-lists with primary key, and name.

Is there a way to search the list for a name and get the list possition back?

···

On Wednesday 18 June 2003 01:00 am, Ilia Kats wrote:

UC

--
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Werner F. Bruhin wrote:

I have a similar problem to Ilia, but I am going the virtual listctrl route, however I am a bit stuck on how to emulate the autocomplition. I am thinking to have a search field below/above the listctrl, but can't figure out a way to use that field and search in something.
Currently I have a dictionary indexed by item number (required to be able to do the cacheHint stuff), this list gets cleared at some point (to save memory), then I have a list where the possition in the list is equal to the possition in the listctrl and it contains sub-lists with primary key, and name.
Is there a way to search the list for a name and get the list possition back?

  aList.index(value)

Returns the index of the first occurrence of value.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!