@ -237,6 +237,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- font: fix AddRemapChar() to work before font has been built.
- font: (api breaking) removed "TTF" from symbol names. also because it now supports OTF.
- nav: SetItemDefaultFocus() level of priority, so widget like Selectable when inside a popup could claim a low-priority default focus on the first selected iem
- nav: allow input system to be be more tolerant of io.DeltaTime=0.0f
- nav: ESC on a flattened child
- nav: Left within a tree node block as a fallback (ImGuiTreeNodeFlags_NavLeftJumpsBackHere by default?)
//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)
}
ImGui::EndCombo();
}
// Using the _simplified_ one-liner Combo() api here
ImGui::SameLine();ShowHelpMarker("Refer to the \"Combo\" section below for an explanation of the full BeginCombo/EndCombo API, and demonstration of various flags.\n");
ImGui::SameLine();ShowHelpMarker("Click on the colored square to open a color picker.\nRight-click on the colored square to show options.\nCTRL+click on individual component to input value.\n");
{
staticfloatcol1[3]={1.0f,0.0f,0.2f};
staticfloatcol2[4]={0.4f,0.7f,0.0f,0.5f};
ImGui::ColorEdit3("color 1",col1);
ImGui::SameLine();ShowHelpMarker("Click on the colored square to open a color picker.\nRight-click on the colored square to show options.\nCTRL+click on individual component to input value.\n");
staticconstchar*item_current=items[0];// Here our selection is a single pointer stored outside the object.
if(ImGui::BeginCombo("combo 1",item_current,flags))// The second parameter is the label previewed before opening the combo.
{
for(intn=0;n<IM_ARRAYSIZE(items);n++)
{
boolis_selected=(item_current==items[n]);
if(ImGui::Selectable(items[n],is_selected))
item_current=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)
}
ImGui::EndCombo();
}
// Simplified one-liner Combo() API, using values packed in a single constant string