Antocomplete listbox

Hi,
I am trying to make an autocomplete listbox.
I started from a previous forum : https://forum.xojo.com/31915-autocomplete-in-a-listbox-cell-at-edit-time
I used the code for the textfield and try to adapt it on the listbox but haven’t been completely successful.
I was thinking maybe somebody else could make it work for everybody.
Here is the link for the project : https://www.dropbox.com/sh/mxebyqgwx9jwuoi/AABGt3gSmK-K05cs9QVd_ICNa?dl=0
When you click on the cell and enter a letter the full name selected appear after the letter, therefore you have the same letter twice instead of 1 letter and the rest of the name selected.

Thanks for your help

Chris

Hi Chris,

Where you were setting the word in the cell, you were using:

    me.ActiveCell.SelText = word

but it should be:

    me.ActiveCell.Text = word

Hi Jason,

Have you tried it because when I do so, I get an “exception of class StackOverfloxException was not handled”.

Thanks

Chris

The project (from 2016) does not add the text to the typed characters…

The original project does not have a Timer (may this be the cause of the Stack overflow ?)

Because you selected it:

me.ActiveCell.SelStart = length me.ActiveCell.SelLength = (me.ActiveCell.Text.Len - length)

In line 1 above, you tell you want the cursor to be at length
and in line 2 you tell you want to select (me.ActiveCell.Text.Len - length) character starting the position set in line 1.

MsgBox(lblisting.cell(0,0))

in the Timer ? What a strange idea. The MsgBox will be displayer n times and I think the Stack overflow comes from there.

If you want this kind of report, better add another Listbox and place the report there…

More tests seems to indicate the Timer is not faultive…

The original article is there:

http://blog.xojo.com/2016/08/10/textfield-with-autocomplete/

[quote=378094:@Christophe Blanc]Hi Jason,

Have you tried it because when I do so, I get an “exception of class StackOverfloxException was not handled”.

Thanks

Chris[/quote]
Yes I did. I did disable the timer and pop-up box as I couldn’t understand what they were trying to achieve.

Okay, done. Fixed the issues, added some convenience and exception protection, and documented the functions.
Did not update the TextField subclass while doing this, it’s exclusively the ListBox.

Oh, and got rid of the god awful variable names, it’s now much more clear what’s going on.

https://www.dropbox.com/s/fd742qp5qvfedw5/AutoCompleteListbox.xojo_binary_project?dl=1

Thank you.

Greetings from Strasbourg, France (with snow !)

Back from WE.
Great job, Thanks a lot to all of you
I am sure it will be useful to a lot of people.

Chris