1
0
mirror of https://github.com/ocornut/imgui.git synced 2025-02-02 12:37:20 +01:00

Demo: Added label edition to Property Editor demo + fix an ID issue. (#8266)

This commit is contained in:
ocornut 2025-01-06 14:35:57 +01:00
parent 80aafbc81b
commit 2f1194a296
2 changed files with 11 additions and 1 deletions

View File

@ -60,7 +60,8 @@ Other changes:
windows with the ImGuiWindowFlags_NoNavInputs flag. (#8231) windows with the ImGuiWindowFlags_NoNavInputs flag. (#8231)
- Debug Tools: Debug Log: hovering 0xXXXXXXXX values in log is allowed even - Debug Tools: Debug Log: hovering 0xXXXXXXXX values in log is allowed even
if a popup is blocking mouse access to the debug log window. (#5855) if a popup is blocking mouse access to the debug log window. (#5855)
- Misc: fixed misc/cpp/imgui_stdlib.h/.cpp not supporting IMGUI_DISABLE. (#8294) [@juur] - Demo: Added label edition to Property Editor demo + fix an ID issue. (#8266) [@moritz-h]
- Misc: Fixed misc/cpp/imgui_stdlib.h/.cpp not supporting IMGUI_DISABLE. (#8294) [@juur]
- Backends: Allegro5: Avoid calling al_set_mouse_cursor() repeatedly since it appears - Backends: Allegro5: Avoid calling al_set_mouse_cursor() repeatedly since it appears
to leak on on X11 (#8256). [@Helodity] to leak on on X11 (#8256). [@Helodity]
- Backends: Vulkan: Fixed setting VkSwapchainCreateInfoKHR::preTransform for - Backends: Vulkan: Fixed setting VkSwapchainCreateInfoKHR::preTransform for

View File

@ -295,6 +295,7 @@ struct ExampleMemberInfo
// Metadata description of ExampleTreeNode struct. // Metadata description of ExampleTreeNode struct.
static const ExampleMemberInfo ExampleTreeNodeMemberInfos[] static const ExampleMemberInfo ExampleTreeNodeMemberInfos[]
{ {
{ "MyName", ImGuiDataType_String, 1, offsetof(ExampleTreeNode, Name) },
{ "MyBool", ImGuiDataType_Bool, 1, offsetof(ExampleTreeNode, DataMyBool) }, { "MyBool", ImGuiDataType_Bool, 1, offsetof(ExampleTreeNode, DataMyBool) },
{ "MyInt", ImGuiDataType_S32, 1, offsetof(ExampleTreeNode, DataMyInt) }, { "MyInt", ImGuiDataType_S32, 1, offsetof(ExampleTreeNode, DataMyInt) },
{ "MyVec2", ImGuiDataType_Float, 2, offsetof(ExampleTreeNode, DataMyVec2) }, { "MyVec2", ImGuiDataType_Float, 2, offsetof(ExampleTreeNode, DataMyVec2) },
@ -8957,6 +8958,8 @@ struct ExampleAppPropertyEditor
ImGui::Separator(); ImGui::Separator();
if (ImGui::BeginTable("##properties", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollY)) if (ImGui::BeginTable("##properties", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollY))
{ {
// Push object ID after we entered the table, so table is shared for all objects
ImGui::PushID((int)node->UID);
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthStretch, 2.0f); // Default twice larger ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthStretch, 2.0f); // Default twice larger
if (node->HasData) if (node->HasData)
@ -8995,10 +8998,16 @@ struct ExampleAppPropertyEditor
ImGui::SliderScalarN("##Editor", field_desc.DataType, field_ptr, field_desc.DataCount, &v_min, &v_max); ImGui::SliderScalarN("##Editor", field_desc.DataType, field_ptr, field_desc.DataCount, &v_min, &v_max);
break; break;
} }
case ImGuiDataType_String:
{
ImGui::InputText("##Editor", reinterpret_cast<char*>(field_ptr), 28);
break;
}
} }
ImGui::PopID(); ImGui::PopID();
} }
} }
ImGui::PopID();
ImGui::EndTable(); ImGui::EndTable();
} }
} }