Skip to content

Table with Radio Button/CheckBox #4172

@m21-cerutti

Description

@m21-cerutti

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

2021_05_25_13-17-07_gui2d

radio_dearimgui

Standalone, minimal, complete and verifiable example: (see #2261)

struct ImGuiParameterState
{
  int selected_radio;
};

static ImGuiParameterState state;

if (ImGui::Begin("Control Panel"))
{
  if (ImGui::BeginTable("9x9_radio_table", 3))
  {
    int i;
    for (i = 0; i < 9; i++)
    {
      ImGui::TableNextColumn();
      if (ImGui::RadioButton("", &state.selected_radio, i))
      {
        std::cout << i << std::endl; // Never called
      }
    }
    ImGui::EndTable();
  }
  
  ImGui::End();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions