Interest in Multi-Column Combobox?

I was wondering if there is interest in a custom combobox with more auto complete options?

Here is a list of features I’d like to implement.

  1. Drop in replacement for existing combo box. Retaining compatibility of all methods, properties, and events. (AutoComplete would be removed.)
  2. Specify as many columns as you wish.
  3. Bind text to specified column
  4. AutoComplete could search bound column or all columns
  5. AutoComplete could be ‘starts with’ or ‘match any’ (contains)
  6. Handle large amounts of data efficiently
  7. Option to require selection
  8. Drop down list would be able to protrude beyond the edge of the parent window.
  9. Settings would allow you to set column width, list width, listrows, and column headings (on/off).
  10. AutoFill option (only available if AutoComplete is set to BoundColumn & StartsWith)

Any more ideas before I get started?

I’ve done enough of testing to know that I can achieve all of the above 6 items.

Regarding number 6:

  1. In tests I was able to load 1 million records 5 column wide, from a local SQLite file in .75 seconds.
  2. Search and update autocomplete drop down list instantly even with 1 million search results being returned.
  3. With 1 million rows and 5 columns the control will use 80-100mb of RAM. In comparison, a list box with the same amount of data uses about 650mb of RAM.

I’m thinking Windows first.

Ability to specify the number of rows that show would be nice.

#9 listrows property should do that. I should also note that if the control is to close to the bottom edge of the screen the list will show above the control.

THis looks very much like a job for a ListBox.

Actually I will be using a standard listbox inside a plainbox window (with some declares to make it work right), for the drop down list.

NOOOOOOOOOOOOOOOO!

[sniff]

Well the combo box is ‘more broke’ on windows and I really need something that works. So I decided while I’m at it I might as well do it right. Unfortunately ALL my paying customers use Windows.

https://forum.xojo.com/36662-combobox-autocomplete-bugs-mac-windows/p1#p301322

Is resizing the drop down list on the fly a necessity? I was hoping to skip this piece complexity.

Fine.!! (sorry Markus)

In the standard listbox removing a row changes the listindex but does not fire the change event even if the listindex is removed changing the text of the listbox.

In my ComboBox subclass I was thinking about firing the Change event when ever an insert or a remove causes the listindex ot the text to change.

Is this the right/desired behavior?

OK. Here is a demo if anyone would like to try it out. https://www.dropbox.com/s/3uhxzosv7llfhmx/Custom%20ComboBox1.zip?dl=0

The control should be a drop in replacement for the standard ComboBox, except for datafield, and datacontrol which are not supported.

In addition to the standard events, methods and properties I added the following:

events

Event InvalidSelection(Text as String) 'If MatchRequired then this event fires when the text entered does not exist in the list. Event ListOpen() As Boolean 'Fires when the dropdown list is shown. Return true to prevent the list from displaying. Event ListClose() 'Fires when the list closes

Methods

BeginTransaction 'Call before adding multiple rows to speed up insertion by 25% Cell(Row, Column) As String 'get the value from the specified cell Cell(Row, Column, assigns Value as String) 'sets the value of a cell CloseDropDown 'call to close the dropdown list CommitTransaction 'Call when finished adding multiple rows. DropDown 'shows the dropdown list

Properties

AutoDropdown 'sets whether the drop down list is autmatically shown when typing. AutoFill 'Choose whether the the text for matching items autofills ColumnCount 'set or get the number of columns ColumnWidths 'sets or gets the columnwidths of the dropdown list DropDownVisible 'checks if the dropdown list is shown. Setting value shows/hides list. ListRows 'The number of rows to be shown in the dropdown list ListWidth 'The wwidth of the dropdown list MatchRequired 'If true the text is cleared and the InvalidSelection is called when the text doesn't exist in the list. SearchType 'Set the type of search to perform TextColumn 'Set the column that is linked to the Text property.

Speed comparison with ComboBox and ListBox

1 column - 17850 items. (ListBox2 is the result when setting scrollbarvirtical to false while adding items.)

32 bit 64 bit ComboBoxPro 0.633 0.566 ComboBox 1.666 1.466 ListBox 5.850 5.300 ListBox2 0.116 0.100

4 coulmns - 17850 items.

32 bit 64 bit ComboBoxPro 1.050 0.833 ComboBox 1.666 1.466 ListBox 5.166 3.883 ListBox2 0.300 0.333

The list works well with 1 million items. However searching starts getting sluggish especially in ‘SearchAny’ mode.

In SearchAny mode a full text search is done on all the columns in the ComboBox. As many words can be searched as needed and the first three words can be in any order. With one million items in a 4 column list full search of three words takes about 3 seconds.

Neil,

Thank you for the demo. It allows me to understand the eventual need fo multicolumns !
(I was searching !)

This is also very useful for customer lookup, when there are thousands of customers. In the example shown above items can be found by typing in the item code, searching the item description, or by scanning in a UPC.

My next goal is to create a listbox subclass that can set the columntype to ComboBoxPro.

Here are a few things that I’m especially pleased with, and would like to highlight.

  1. Search feature. Flexibility, and speed.
  2. DropDown list can protrude beyond the edge of the parent window.
  3. Clicking on the DropDown list doesn’t ‘steel’ the focus from the parent window.
  4. Ability to handle large amounts of data quickly and efficiently. Add 1 million rows X 4 columns in about 60 seconds. Total app memory usage goes to approx. 150Mb.

I would not store 1 millions rows in a listbox.
I would let them stay in a database (eventually in memory)
then the search result can be displayed in a listbox, it will contain much less rows
you can force the user to type 2-3 chars before displaying a result.
speed can greatly improve that way.

[quote=336782:@Jean-Yves Pochez]I would not store 1 millions rows in a listbox.
I would let them stay in a database (eventually in memory)
then the search result can be displayed in a listbox, it will contain much less rows
[/quote]

The only thing ever displayed in the listbox are the search results. The list contents are stored in an in memory SQLite database.

[quote=336782:@Jean-Yves Pochez]you can force the user to type 2-3 chars before displaying a result.
speed can greatly improve that way.[/quote]

That is an interesting thought. Currently I overcome the speed issue by showing large results in increments of 100. This makes the search appear to be instant, even when dealing with 100K records.

It looks interesting.

I’ve been using it in production for customer lookup/selection for over a year now with no problems.

I‘m always amazed that most people forget to include links …

I can see the link to the demo. My guess is: this is not a free project.