The selected item
| Chapter 12. The DropDown Widget |

## The selected item

To discover what item, if any, the user has selected from the `DropDown`, call `DropDown::get_selected()`. This returns an unsigned int that you can use to get the selected data from the model. For instance, you might read an integer ID value from the model, even though you have chosen only to show the human-readable description in the `DropDown`. For instance:

    unsigned int sel = m_DropDown.get_selected();
    if (sel != GTK_INVALID_LIST_POSITION)
    {
      // Get the data for the selected row, using our knowledge of the list model:
      auto id = m_ListStore->get_item(sel).m_col_id;
      set_some_id_chosen(id); // Your own function.
    }
    else
      set_nothing_chosen(); // Your own function.

Chapter 12. The DropDown Widget |  | Responding to changes