@@ -2863,7 +2863,7 @@ static void DemoWindowWidgetsSelectionAndMultiSelect(ImGuiDemoWindowData* demo_d
28632863
28642864 const int ITEMS_COUNT = 10000;
28652865 ImGui::Text("Selection: %d/%d", selection.Size, ITEMS_COUNT);
2866- if (ImGui::BeginTable("##Basket", 2, ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter))
2866+ if (ImGui::BeginTable("##Basket", 2, ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter, ImVec2(0.0f, ImGui::GetFontSize() * 20) ))
28672867 {
28682868 ImGui::TableSetupColumn("Object");
28692869 ImGui::TableSetupColumn("Action");
@@ -2884,13 +2884,15 @@ static void DemoWindowWidgetsSelectionAndMultiSelect(ImGuiDemoWindowData* demo_d
28842884 {
28852885 ImGui::TableNextRow();
28862886 ImGui::TableNextColumn();
2887+ ImGui::PushID(n);
28872888 char label[64];
28882889 sprintf(label, "Object %05d: %s", n, ExampleNames[n % IM_ARRAYSIZE(ExampleNames)]);
28892890 bool item_is_selected = selection.Contains((ImGuiID)n);
28902891 ImGui::SetNextItemSelectionUserData(n);
28912892 ImGui::Selectable(label, item_is_selected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap);
28922893 ImGui::TableNextColumn();
28932894 ImGui::SmallButton("hello");
2895+ ImGui::PopID();
28942896 }
28952897 }
28962898
@@ -4084,6 +4086,7 @@ static void DemoWindowWidgetsTreeNodes()
40844086 ImGui::CheckboxFlags("ImGuiTreeNodeFlags_SpanAllColumns", &base_flags, ImGuiTreeNodeFlags_SpanAllColumns); ImGui::SameLine(); HelpMarker("For use in Tables only.");
40854087 ImGui::CheckboxFlags("ImGuiTreeNodeFlags_AllowOverlap", &base_flags, ImGuiTreeNodeFlags_AllowOverlap);
40864088 ImGui::CheckboxFlags("ImGuiTreeNodeFlags_Framed", &base_flags, ImGuiTreeNodeFlags_Framed); ImGui::SameLine(); HelpMarker("Draw frame with background (e.g. for CollapsingHeader)");
4089+ ImGui::CheckboxFlags("ImGuiTreeNodeFlags_FramePadding", &base_flags, ImGuiTreeNodeFlags_FramePadding);
40874090 ImGui::CheckboxFlags("ImGuiTreeNodeFlags_NavLeftJumpsToParent", &base_flags, ImGuiTreeNodeFlags_NavLeftJumpsToParent);
40884091
40894092 HelpMarker("Default option for DrawLinesXXX is stored in style.TreeLinesFlags");
@@ -4748,7 +4751,7 @@ static void DemoWindowLayout()
47484751 // Tree
47494752 // (here the node appears after a button and has odd intent, so we use ImGuiTreeNodeFlags_DrawLinesNone to disable hierarchy outline)
47504753 const float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
4751- ImGui::Button("Button##1");
4754+ ImGui::Button("Button##1"); // Will make line higher
47524755 ImGui::SameLine(0.0f, spacing);
47534756 if (ImGui::TreeNodeEx("Node##1", ImGuiTreeNodeFlags_DrawLinesNone))
47544757 {
@@ -4758,14 +4761,22 @@ static void DemoWindowLayout()
47584761 ImGui::TreePop();
47594762 }
47604763
4764+ const float padding = (float)(int)(ImGui::GetFontSize() * 1.20f); // Large padding
4765+ ImGui::PushStyleVarY(ImGuiStyleVar_FramePadding, padding);
4766+ ImGui::Button("Button##2");
4767+ ImGui::PopStyleVar();
4768+ ImGui::SameLine(0.0f, spacing);
4769+ if (ImGui::TreeNodeEx("Node##2", ImGuiTreeNodeFlags_DrawLinesNone))
4770+ ImGui::TreePop();
4771+
47614772 // Vertically align text node a bit lower so it'll be vertically centered with upcoming widget.
47624773 // Otherwise you can use SmallButton() (smaller fit).
47634774 ImGui::AlignTextToFramePadding();
47644775
47654776 // Common mistake to avoid: if we want to SameLine after TreeNode we need to do it before we add
4766- // other contents below the node.
4767- bool node_open = ImGui::TreeNode("Node##2 ");
4768- ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##2 ");
4777+ // other contents "inside" the node.
4778+ bool node_open = ImGui::TreeNode("Node##3 ");
4779+ ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##3 ");
47694780 if (node_open)
47704781 {
47714782 // Placeholder tree data
@@ -4775,13 +4786,13 @@ static void DemoWindowLayout()
47754786 }
47764787
47774788 // Bullet
4778- ImGui::Button("Button##3 ");
4789+ ImGui::Button("Button##4 ");
47794790 ImGui::SameLine(0.0f, spacing);
47804791 ImGui::BulletText("Bullet text");
47814792
47824793 ImGui::AlignTextToFramePadding();
47834794 ImGui::BulletText("Node");
4784- ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##4 ");
4795+ ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##5 ");
47854796 ImGui::Unindent();
47864797 }
47874798
0 commit comments