You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have been reading the ListBox code and I have been looking up other examples of its use but I'm still getting confused about how it is used.
I want to be able to have a listbox's source array be programmatically filled and then to also be able to select more than one option from the listbox.
Is it possible you (or anyone) could show me an example if not, explain how to achieve this at least?
The text was updated successfully, but these errors were encountered:
Czar-Ec
changed the title
ListBox
ListBox multiple selection
Jan 2, 2018
if (ListBoxHeader(...))
{
// display your items here, using e.g. Selectable()
}
ListBoxFooter();
So the programmatic filling is up to you, as well as the selection state which is stored on your side (when calling Selectable() you specify yourself is the item is selected). In the demo windows under Widgets: Selectables there are a handful of examples with persistent selection, and I have just updated the imgui_demo.cpp code now to add a few extra examples.
So assuming you have a list says vector<MyObj*>.
You may want to store your selection state either inside each object e.g. bool IsSelected, either externally Vector<MyObj*> ListOfSelectedObjects;. There are pros and cons to each methods.
Note that ListBoxHeader()/ListboxFooter() are legacy names and I expect to rename them to BeginListBox()/EndListBox() at some point. This should not really affect you at all.
Hello, I have been reading the ListBox code and I have been looking up other examples of its use but I'm still getting confused about how it is used.
I want to be able to have a listbox's source array be programmatically filled and then to also be able to select more than one option from the listbox.
Is it possible you (or anyone) could show me an example if not, explain how to achieve this at least?
The text was updated successfully, but these errors were encountered: