Demo: Tweaks format.

This commit is contained in:
omar 2018-01-11 15:22:33 +01:00
parent 398a4e1865
commit 12aa3cb09e

View File

@ -1061,33 +1061,39 @@ void ImGui::ShowDemoWindow(bool* p_open)
goto_line |= ImGui::InputInt("##Line", &line, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue); goto_line |= ImGui::InputInt("##Line", &line, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue);
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::BeginChild("Sub1", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f,300), false, ImGuiWindowFlags_HorizontalScrollbar | (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0)); // Child 1: no border, enable horizontal scrollbar
for (int i = 0; i < 100; i++)
{ {
ImGui::Text("%04d: scrollable region", i); ImGui::BeginChild("Child1", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, 300), false, ImGuiWindowFlags_HorizontalScrollbar | (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0));
if (goto_line && line == i) for (int i = 0; i < 100; i++)
{
ImGui::Text("%04d: scrollable region", i);
if (goto_line && line == i)
ImGui::SetScrollHere();
}
if (goto_line && line >= 100)
ImGui::SetScrollHere(); ImGui::SetScrollHere();
ImGui::EndChild();
} }
if (goto_line && line >= 100)
ImGui::SetScrollHere();
ImGui::EndChild();
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); // Child 2: rounded border
ImGui::BeginChild("Sub2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0));
ImGui::Text("With border");
ImGui::Columns(2);
for (int i = 0; i < 100; i++)
{ {
if (i == 50) ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
ImGui::NextColumn(); ImGui::BeginChild("Child2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0));
char buf[32]; ImGui::Text("With border");
sprintf(buf, "%08x", i*5731); ImGui::Columns(2);
ImGui::Button(buf, ImVec2(-1.0f, 0.0f)); for (int i = 0; i < 100; i++)
{
if (i == 50)
ImGui::NextColumn();
char buf[32];
sprintf(buf, "%08x", i*5731);
ImGui::Button(buf, ImVec2(-1.0f, 0.0f));
}
ImGui::EndChild();
ImGui::PopStyleVar();
} }
ImGui::EndChild();
ImGui::PopStyleVar();
ImGui::TreePop(); ImGui::TreePop();
} }