Skip to content

Sliders change unwanted on clicking other slider #7375

Closed
@ghost

Description

Version/Branch of Dear ImGui:

1.90.4

Back-ends:

IrrImGUI

Compiler, OS:

MSVC (Windows)

Full config/build information:

No response

Details:

Look at code/video

Screenshots/Video:

error_w_sliders.webm

Minimal, Complete and Verifiable Example code:

        static int o_selection=1;
	ImGui::SetNextItemWidth(p(screenSize.Width,68));
	ImGui::SliderInt("", &o_selection, 1, 2, "");

	if(o_selection==1) { ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f)); }
	ImGui::Text(translate("Online Multiplayer").c_str());
	if(o_selection==1) { ImGui::PopStyleColor(); } else { ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f)); }
	ImGui::SameLine();
	ImGui::SetCursorPosX(p(screenSize.Width,69)-ImGui::CalcTextSize(translate("Local Singleplayer").c_str()).x);
	ImGui::Text(translate("Local Singleplayer").c_str());
	if(o_selection==2){ ImGui::PopStyleColor(); }

	ImGui::SeparatorText(translate("Difficulty").c_str());
	static float difficulty=0.5;
	ImGui::SetNextItemWidth(p(screenSize.Width,68));
	ImGui::SliderFloat("", &difficulty, 0.5f, 10.0f);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions