mirror of
https://github.com/ocornut/imgui.git
synced 2026-04-01 21:17:42 -05:00
Demo: Added label edition to Property Editor demo + fix an ID issue. (#8266)
This commit is contained in:
@@ -295,6 +295,7 @@ struct ExampleMemberInfo
|
||||
// Metadata description of ExampleTreeNode struct.
|
||||
static const ExampleMemberInfo ExampleTreeNodeMemberInfos[]
|
||||
{
|
||||
{ "MyName", ImGuiDataType_String, 1, offsetof(ExampleTreeNode, Name) },
|
||||
{ "MyBool", ImGuiDataType_Bool, 1, offsetof(ExampleTreeNode, DataMyBool) },
|
||||
{ "MyInt", ImGuiDataType_S32, 1, offsetof(ExampleTreeNode, DataMyInt) },
|
||||
{ "MyVec2", ImGuiDataType_Float, 2, offsetof(ExampleTreeNode, DataMyVec2) },
|
||||
@@ -8957,6 +8958,8 @@ struct ExampleAppPropertyEditor
|
||||
ImGui::Separator();
|
||||
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_WidthStretch, 2.0f); // Default twice larger
|
||||
if (node->HasData)
|
||||
@@ -8995,10 +8998,16 @@ struct ExampleAppPropertyEditor
|
||||
ImGui::SliderScalarN("##Editor", field_desc.DataType, field_ptr, field_desc.DataCount, &v_min, &v_max);
|
||||
break;
|
||||
}
|
||||
case ImGuiDataType_String:
|
||||
{
|
||||
ImGui::InputText("##Editor", reinterpret_cast<char*>(field_ptr), 28);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
ImGui::PopID();
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user