Hierarchical combobox

Curious if there is anyway to make a combobox that has a treelike structure. I have a combo box for location for an desktop app and it’s getting big. I’d like to make it hierarchical so I can select an expandable section and be able to select from it. Similar to a menu but not in the menu bar, but in a combobox. Any ideas?

Ever thought of using DesktopListBox?

That has a hierarchical option…and besides that…you can customize with paint events how it has to look.

Or do you need the menu option in the DesktopComboBox?

I use the DesktopListBox in my IDE project and looks like (just a one level hierarchy):

Do you have maybe a screenshot how it looks now and how it should look in the end?

As a last resort there is always DesktopCanvas (o;

The listbox takes up too much room, I have room for the combobox which works great except the list is getting so I have to scroll. Here’s part of what it looks like now

clicking the location combobox gives me a list of options - but I’d rather have them nested by country or state then choose, or have a default location expanded.

I do this all of the time with a text box and listbox.
When you type the Payment Id into the text field the first matching id is selected in the Payment Id listbox and the listbox visible property is set to True. When you click on the Payment Id you want the listbox’s visible property is set to false.
Screenshot 2024-10-11 at 2.51.49 PM

Fake it with a hierarchical menu

-Karen

1 Like

Can you provide more details on how I might do that.

I can type in the combobox already and it pops up with the matching text selected. This is not really what I am looking for.

I suppose I could create a contextual menu on the combo box, but that doesn’t seem to be working, I tried switching to a text box as technically it wouldn’t need to be a combobox if there is an attached contextual menu. The contextual menu shows up on this but won’t make any submenus…I get error Type DesktopmenuItem has no member named “Append”

on the following
base.AddMenu(New MenuItem(“Home”))
base.AddMenu(New MenuItem(“Whitehall”))
Var submenu As New MenuItem(“Italy”)
submenu.Append(New MenuItem(“Como”))
submenu.Append(New MenuItem(“Venice”))
base.Append(submenu)

Return True

Figured it out. Made a contextual menu on a textfield (not a DesktopTextField) - the submenus do not work in it. And it works great.