Autocomplete in a ListBox Cell at Edit time ?

Is it possible to get an Autocomplete in a ListBox Cell at Edit time feature ? If yes, advices are welcome.

I searched yeterday, starting by a PopupMenu into a ListBox --> not on standard Listbox.

Then I was thinking at a number of PopupMenus beside earch Listbox Row: what if there is more PopupMenus than the actual monitor height ?

Then… I put only one entry in the Listbox last column :frowning:

And when I awoke I was alone, this bird had flown * sorry… when I awoke I had Autocomplete in mind and feel this can be a nice solution ! 'till i make a search, then now.

  • Norwegian Wood (This Bird Has Flown), The Beatles

When you click on a cell, embed a container over it that contains a PopupMenu or ComboBox.

axel’s schneider example here : https://forum.xojo.com/19393-desktop-listbox-with-combobox/?quote=162848#reply

David:
Thank you.
Can you be a bit more specific ? (how can I embed a container over a Listbox Cell at Edit time ?)

Jean-Yves, Axel:
Thank you.

When you click on a Cell an event is raised. You know the Row and Column from this event. You should be able to work out the X and Y location of this cell on the screen.

Create a tiny container control with a single popup menu on it and an OK button. When the event above occurs, use the Window embed container command at the X/Y location. Then set the container to disappear when the user clicks OK. Place the popup menu’s value into the original cell.

Thanks David.

Nota:

I found in my archives hard disk an autocomplete project from 2004 (from www.dingostick.com, a guy now working at Microsoft). This rbo worked on REALbasic’s EditField, but a Super class change make it work on TextField.

The real question now is: how can I get a reference to the used TextField while in Edit Cell Mode ?

PS: a quick search in the web site leaves me alone, and I forgot to copy the original project on my boot disk (256GB SSD…)

At last, I think I also saw another project (still long time ago) that worked like actual Xojo’s auto-complete. I will try to resume the search and hope to locate it today or on Sunday.

I’ve continued the trail on google and found:

https://leaverou.github.io/awesomplete/

example.

look at ListBox.ActiveCell property.

Thanks Jean-Yves.

Just like Invalidate, the name does not reflect in my mind what it do. ;-:slight_smile:

At last, I located the example, make a copy in my Boot SSD and here we are:


Example window where I changed the default list of words to be used in a DataBase. I kept the web site name of the original author, back in 2004.

Notable thing to know:

a. the original example extension was .rb. That extension is ignored by Xojo (2015r1): the project appears as Ruby Source on my OS X laptop.
b. I added a p to the extension (to be .rbp) and Xojo allows me to load it. *
c. At Xojo’s IDE open time, I was asked to update the project and so did I
Check All, Resolve, Close.
The AutoComple Class Super have been changed from EditField to TextField (Xojo)
d. I enlarged both the StaticText1 Class / and Window1 to display the whole text,
e. I modified the word list to match a use for DataBase,
f. I removed the Events: KeyDown, Open and TextChange because Xojo flag KeyDown event as a duplicate (already exists in the AutoComplete Super).
g. I modified the MenuBar name,
h. I added a separator and Select All in the Edit Menu (unavailable by default at the time),
i. I forgot if I made any other change.

That’s all folks !

One thing I do not had time to do is to check how useable this can be, but it works (watch the image above ;-:slight_smile:

I nearly forgot to put the link to the project (39KB).

Enjoy.

I forgot one step:
at save time, I get the Missing Code warning: I click to savethe new project (to xojo_binary_project).