-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table with Radio Button/CheckBox #4172
Labels
label/id and id stack
implicit identifiers, pushid(), id stack
Comments
Hello,
|
Oh i'm verry sorry, i have read too quickly the usage. if (ImGui::BeginTable("9x9_radio_table", 3))
{
for (int i = 0; i < 9; i++)
{
ImGui::TableNextColumn();
std::string id = "##radio_table_" + std::to_string(i);
if (ImGui::RadioButton(id.c_str(), &state.selected_radio, i))
{
int row = ImGui::TableGetRowIndex();
int col = ImGui::TableGetColumnIndex();
std::cout << row << ";" << col << std::endl;
}
}
ImGui::EndTable();
} |
You might want to reread this FAQ entry carefully, because in this situation using for (int i = 0; i < 9; i++)
{
ImGui::TableNextColumn();
ImGui::PushID(i);
if (ImGui::RadioButton("", &state.selected_radio, i))
{
int row = ImGui::TableGetRowIndex();
int col = ImGui::TableGetColumnIndex();
std::cout << row << ";" << col << std::endl;
}
ImGui::PopID();
} |
ocornut
added a commit
that referenced
this issue
Sep 10, 2024
Also #74, #96, #480, #501, #647, #654, #719, #843, #894, #1057, #1173, #1390, #1414, #1556, #1768, #2041, #2116, #2330, #2475, #2562, #2667, #2807, #2885, #3102, #3375, #3526, #3964, #4008, #4070, #4158, #4172, #4199, #4375, #4395, #4471, #4548, #4612, #4631, #4657, #4796, #5210, #5303, #5360, #5393, #5533, #5692, #5707, #5729, #5773, #5787, #5884, #6046, #6093, #6186, #6223, #6364, #6387, #6567, #6692, #6724, #6939, #6984, #7246, #7270, #7375, #7421, #7434, #7472, #7581, #7724, #7926, #7937 and probably more.. Tagging to increase visibility!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version/Branch of Dear ImGui:
Version: 1.83
Branch: master
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_opengl3.cpp + custom OpenInventor backend
Compiler: MSVC 14.16
Operating System: Windows 10
My Issue/Question:
Linked to #125.
Hello, I am trying to do a table with radio button for selectionning one item in a table.
But the problem is it don't actualise the state, and never trigger that a radio button have been clicked.
I have also tried with CheckBox and Selectionable and slight difference in code, but same result.
There is also no demo from what i have seen in this version using this particular case.
Screenshots/Video
Standalone, minimal, complete and verifiable example: (see #2261)
The text was updated successfully, but these errors were encountered: