Add ComboBox to Cell of ListBox on click

I would like to allow the user to select from a dropdown or type in own content when a cell is clicked/tabbed into.

Is it possible instantiate a ComboBox custom subclass and add it to a cell of a listbox when the user clicks on it?

Sure, but you would have to create the control yourself using a canvas, which might be a fair amount of work.

It’s easy to add a pop-up contextual menu, but it won’t be confined to the cell width. For entry of user text, you could use a modifier key to prevent the menu from popping up.

What if I already have a subclass of a ComboBox already defined. Can I add it to a cell using a canvas when the cell is clicked? Or do you mean I’d have to created the entire combobox control in the canvas from scratch?

You would have to create the entire control in the canvas from scratch. I went with a different method, but it is a little too complicated for the forum. Ie., it took a lot of work to make something like this work right.

1 Like

this is a working example of a listbox with combobox
be aware though, that it has been made with API1 xojo, and may have to be adapted for api2
and the new desktop controls.

Thanks, this looks great.