[Gtk-sharp-list] CellRenderer combo with completion

Tomas Trescak tomi.trescak at gmail.com
Wed Aug 29 08:03:53 UTC 2012


Dears

I am trying to implement the cellrenderer combo with completion.
I have found a solution for this online but in that solution GTK returns 
a ComboBox object and not ComboBoxEntry object for me.
Below is a code:

var combosource = InitComboSource();

var cell = new CellRendererCombo();
cell.TextColumn = 0;
cell.EditingStarted += (o, args) => {
      if ( args.Editable is Gtk.ComboBoxEntry ) {
           Gtk.ComboBoxEntry editableCmb = args.Editable as 
Gtk.ComboBoxEntry; // !!!!! Here it never returns a ComboBoxEntry object 
for me :( It's always a ComboBox.

           if (editableCmb.Entry.Completion == null)
           {
               editableCmb.Entry.Completion = new EntryCompletion();

               ListStore store = new ListStore (typeof (string));
               foreach (var val in comboSource) {
                    store.AppendValues (val.ToString());
               }
               editableCmb.Entry.Completion.Model = store;
               editableCmb.Entry.Completion.TextColumn = 0;
           }
      }
};



More information about the Gtk-sharp-list mailing list