Skip to content

[BUG] SliderInt value changing unwantedly on TreeNode click spam #2041

Closed
@deniz617

Description

Version/Branch of Dear ImGui:

v1.62

Back-end file/Renderer/OS:

Back-ends: Standart imgui & D3D9
OS: Windows 10 - 64 Bit
Compiler: Standart Visual Studio 2017 C++

My Issue/Question:
So as first im pretty new on imgui(just my first days) this is not a question or i don't need help i just wanted to report this bug that i found while starting to explore imgui.
When you spam to open a 'TreeNode' with a 'SliderInt' under it, the slider changes the value relevant to the mouse position but you don't press the slider. How this happen? On the SliderInt arguments the text(argument0) must be "", if you write " \0" everything works like it should. I Hope i was able to help you improving the library. Keep up the good work & Have a good day!

Standalone, minimal, complete and verifiable example:

//IMGUI NEW FRAME
ImGui_ImplDX9_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();

//BEGIN STUFF

ImGui::Begin("Hello World!");

if (ImGui::TreeNode("Settings"))  //Open the node and change the slider value now spam click the TreeNode you will notice the slider value got changed. 
{
    ImGui::InputInt("Range", &range);
    ImGui::SliderInt("", &range, 1, 15, "Range: %d"); //if arg0 == "" the value changes while spamming the tree node with clicks
    ImGui::TreePop();
}

ImGui::End();

//END STUFF

//IMGUI EndFrame
ImGui::EndFrame();

//IMGUI Render
ImGui::Render();
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());

Screenshots/Video (you can drag files here)

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions