Scrollbar: horizontal scrollbar demo allows to enable simultanaeous scrollbars on both axises.

This commit is contained in:
ocornut 2015-09-30 21:15:47 +02:00
parent b92daf0ba2
commit 5d3d136733

View File

@ -966,10 +966,12 @@ void ImGui::ShowTestWindow(bool* opened)
{
ImGui::Bullet(); ImGui::TextWrapped("Horizontal scrolling for a window has to be enabled explicitly via the ImGuiWindowFlags_HorizontalScrollbar flag.");
ImGui::Bullet(); ImGui::TextWrapped("You may want to explicitly specify content width by calling SetNextWindowContentWidth() before Begin().");
static int lines = 7;
ImGui::SliderInt("Lines", &lines, 1, 15);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 1.0f));
ImGui::BeginChild("scrolling", ImVec2(0, ImGui::GetItemsLineHeightWithSpacing()*7 + 30), true, ImGuiWindowFlags_HorizontalScrollbar);
for (int line = 0; line < 7; line++)
for (int line = 0; line < lines; line++)
{
// Display random stuff
int num_buttons = 10 + ((line & 1) ? line * 9 : line * 3);