-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Some ImGui::Button not detecting click #6093
Copy link
Copy link
Closed
Labels
label/id and id stackimplicit identifiers, pushid(), id stackimplicit identifiers, pushid(), id stack
Description
I have 3 buttons created by a for loop and being drawn in a Child. I am facing some problems when clicking in buttons that do not have index 0, in fact they aren't detecting the press. The program should change focus and active variables when I click in some of those 3 buttons and the text " Selected Button is at index: x" should be printed but the button press is only be detecting when I click the first/top button.
int ImGuiListViewEx(std::vector<std::string>& items, int& focus, int& scroll, int& active) {
ImGui::SetNextWindowSize(ImVec2(400, 200)); // set the container size
ImVec2 screen = ImGui::GetIO().DisplaySize;
ImVec2 childSize = ImVec2(.2 * screen.x, .7 * screen.y);
ImGui::BeginChild("Entities List", childSize, true, ImGuiWindowFlags_HorizontalScrollbar);
for (int i = 0; i < 3; i++) {
if (ImGui::Button("Hello World Button", ImVec2(120,40))) {
std::cout << "Selected Button is at index: " << i << std::endl;
focus = i;
active = i;
}
}
ImGui::EndChild();
return active;
}If you need some context I will past the full minimal reproducible example here: https://pastebin.com/RnSMftta
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
label/id and id stackimplicit identifiers, pushid(), id stackimplicit identifiers, pushid(), id stack