[Gtk-sharp-list] Gtk.ComboBoxEntry either Ridiculously designed, or i'm dumb!

Todd Berman tberman at off.net
Sun May 15 22:41:47 EDT 2005


On Sun, 2005-05-15 at 20:09 -0600, Phil Durand wrote:
> Ok, I'm using a Gtk.ComboBoxEntry (because the ComboBox is now
> obsolete) but I'm really finding it hard to use. I dont have an
> "entry" object in it, like the combobox had before, so I have no way
> of grabbing the text directly from the widget unless I play with
> Iters... its really becoming tedious.
> 

ComboBox is not obsolete, Combo is.

> Before, I could do:
> 
> Combo.Text = "new text";
> 
> but now, I have to do:
> 
> Gtk.TreeIter iter;
> 
> Combo.GetActiveIter(out iter);
> 
> Combo.Model.SetValue(iter, 1, "new text");

Understandably this is more work, but if you actually look into what you
can get from a ComboBox that you couldn't from a Combo, you would be
very thankful.

If you want an easy api however, there is the following:

ComboBoxEntry.NewText () (Factory method, that returns a new 'text'
combobox entry)
ComboBoxEntry.AppendText ()
ComboBoxEntry.InsertText ()
ComboBoxEntry.PrependText ()
and
ComboBoxEntry.RemoveText ()

Those functions should give you everything you need.

Keep in mind that those apis exist also for the regular ComboBox.

--Todd



More information about the Gtk-sharp-list mailing list