[Gtk-sharp-list] Comboboxentry Completion selected iter

gidanmx2 gidanmx2 at gmail.com
Sun Feb 13 10:17:17 EST 2011


Hello!

I have a comboboxentry like that:

...
ListStore dati;
...
this.dati = new ListStore (typeof(string), typeof(string));
comboboxentry1.Entry.Completion = new EntryCompletion ();
comboboxentry1.Entry.Completion.InlineSelection = true;
comboboxentry1.Entry.Completion.InlineCompletion = true;
comboboxentry1.Entry.Completion.TextColumn = 0;
comboboxentry1.Entry.Completion.Model = this.dati;
CellRendererText cell = new CellRendererText ();
comboboxentry1.PackStart (cell, false);
comboboxentry1.AddAttribute (cell, "text", 1);
CellRendererText cell2 = new CellRendererText ();
cell2.Alignment = Pango.Alignment.Right;
comboboxentry1.PackStart (cell2, false);
comboboxentry1.AddAttribute (cell2, "text", 0);
comboboxentry1.Model = this.dati;
SqliteConnection sqlc = new SqliteConnection (this.connectionString);
sqlc.Open ();
SqliteCommand query = new SqliteCommand ();
query.Connection = sqlc;
query.CommandText = "SELECT ROWID,* FROM anagrafiche ORDER BY nome,cognome
ASC";
SqliteDataReader reader = query.ExecuteReader ();
while (reader.Read ()) {
	dati.AppendValues (reader["nome"].ToString () + " " +
reader["cognome"].ToString (), reader["ROWID"].ToString ());
}
...

And I get the selected value in this way:

TreeIter iter = new TreeIter ();
comboboxentry1.GetActiveIter (out iter);
string userid = (string)this.dati.GetValue (iter, 1);

Everything goes in the right direction if I select an item from the
dropdownlist but if I search I get this error:

Gtk-CRITICAL **: gtk_list_store_get_value: assertion `VALID_ITER (iter,
list_store)' failed
GLib-GObject-CRITICAL **: g_value_unset: assertion `G_IS_VALUE (value)'
failed

What's wrong?
-- 
View this message in context: http://mono.1490590.n4.nabble.com/Comboboxentry-Completion-selected-iter-tp3303707p3303707.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.


More information about the Gtk-sharp-list mailing list