ImGui::Combo("combo scroll",&item2,items,IM_ARRAYSIZE(items));// Combo using proper array. You can also pass a callback to retrieve array value, no need to create/copy an array just for that.
{
// Simplified one-liner Combo() API, using values packed in a single constant string
//ImGui::Combo("combo w/ array of char*", ¤t_item_2_idx, items, IM_ARRAYSIZE(items)); // Combo using proper array. You can also pass a callback to retrieve array value, no need to create/copy an array just for that.
// General BeginCombo() API, you have full control over your selection data and display type
if(ImGui::BeginCombo("combo 2",current_item_2))// The second parameter is the label previewed before opening the combo.
{
for(intn=0;n<IM_ARRAYSIZE(items);n++)
{
boolis_selected=(current_item_2==items[n]);// You can store your selection however you want, outside or inside your objects
if(ImGui::Selectable(items[n],is_selected))
current_item_2=items[n];
if(is_selected)
ImGui::SetItemDefaultFocus();// Set the initial focus when opening the combo (scrolling + for keyboard navigation support in the upcoming navigation branch)