[Gtk-sharp-list] Set item in ComboBox (novice in GTK#)

Paulinho amf.paulo at gmail.com
Sat Jun 18 19:42:04 EDT 2005


Hi all,

I need to set a item in ComboBox, How i do that ?

In Web i just make this:
myCombo.SelectedValue = "2" , automatically myCombo show me "Description
of Option #2"
sorry i'm novice in GTK# client applications


my code:

CellRendererText descricao = new CellRendererText ();
CellRendererText id          = new CellRendererText ();

comboBoxStore = new ListStore (typeof (string), typeof (string));
cbFiltro.Model = comboBoxStore;

cbFiltro.PackStart (descricao, false);

cbFiltro.AddAttribute (descricao, "text"  , 0);

comboBoxStore.AppendValues("Option #1", "1");
comboBoxStore.AppendValues("Option #2", "2");
comboBoxStore.AppendValues("Option #3", "3");

...
...

string mySelection = "2";

???


How to set the row of ListStore or ComboBox using a value into variable
"mySelection" ?


Magalhaes

/* Sorry my english */


More information about the Gtk-sharp-list mailing list