Skip to content

Commit 2f1194a

Browse files
committed
Demo: Added label edition to Property Editor demo + fix an ID issue. (#8266)
1 parent 80aafbc commit 2f1194a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

docs/CHANGELOG.txt

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

imgui_demo.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ struct ExampleMemberInfo
295295
// Metadata description of ExampleTreeNode struct.
296296
static const ExampleMemberInfo ExampleTreeNodeMemberInfos[]
297297
{
298+
{ "MyName", ImGuiDataType_String, 1, offsetof(ExampleTreeNode, Name) },
298299
{ "MyBool", ImGuiDataType_Bool, 1, offsetof(ExampleTreeNode, DataMyBool) },
299300
{ "MyInt", ImGuiDataType_S32, 1, offsetof(ExampleTreeNode, DataMyInt) },
300301
{ "MyVec2", ImGuiDataType_Float, 2, offsetof(ExampleTreeNode, DataMyVec2) },
@@ -8957,6 +8958,8 @@ struct ExampleAppPropertyEditor
89578958
ImGui::Separator();
89588959
if (ImGui::BeginTable("##properties", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollY))
89598960
{
8961+
// Push object ID after we entered the table, so table is shared for all objects
8962+
ImGui::PushID((int)node->UID);
89608963
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed);
89618964
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthStretch, 2.0f); // Default twice larger
89628965
if (node->HasData)
@@ -8995,10 +8998,16 @@ struct ExampleAppPropertyEditor
89958998
ImGui::SliderScalarN("##Editor", field_desc.DataType, field_ptr, field_desc.DataCount, &v_min, &v_max);
89968999
break;
89979000
}
9001+
case ImGuiDataType_String:
9002+
{
9003+
ImGui::InputText("##Editor", reinterpret_cast<char*>(field_ptr), 28);
9004+
break;
9005+
}
89989006
}
89999007
ImGui::PopID();
90009008
}
90019009
}
9010+
ImGui::PopID();
90029011
ImGui::EndTable();
90039012
}
90049013
}

0 commit comments

Comments
 (0)