2

I'm using C++ to create a GLUI window. I have a radio button, and I am trying to get the two options I have to have different callbacks.

For now, this is my code:

radio = glui->add_radiogroup_to_panel(panel_1, NULL,
                                      RADIOBUTTON_ID,control_cb);
glui->add_radiobutton_to_group( radio, "Choice1");
glui->add_radiobutton_to_group( radio, "Choice2");

I am trying to get the value of the radio group, either 0 or 1, to then pass an if loop to control_cb

case RADIOBUTTON_ID:
    int choice = /*value of radiobutton*/
    if (choice == 0) printf("Hello");
    else printf("world");

The question is, how to get that value for int choice?

Thank you!

L.R.
  • 423
  • 2
  • 5
  • 15

1 Answers1

1

Use the RadioGroup method get_int_val():

int choice = radio->get_int_val();
Hatted Rooster
  • 35,759
  • 6
  • 62
  • 122