How do I get the selected value (either the string, or an int reference) from a Gtk.ComboBox in mono? All I can find is stuff about using iterators. Why isn't there a function to simply fetch the value (or is there)?
For (int) index you can use:
comboBox.Active;
and for text:
comboBox.ActiveText;
to get the selected value in a GTK+ combo box I used:
TreeIter tree;
comboBox.GetActiveIter(out tree);
TreeModel = comboBox.Model ();
String selectedText = (String) comboBox.Model.GetValue (tree, 0);
"comboBox" is the GTK combo box. I hope this will help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With