[Gtk-sharp-list] Gtk.ComboBox.Count ?

Peter Johanson latexer at gentoo.org
Sat Dec 10 16:01:10 EST 2005

On Sat, Dec 10, 2005 at 09:51:56PM +0100, Gennadiy Donchyts wrote:
>    Is there something like Count in the ComboBox, or IList
>    ComboBox.Items?
>    I checked gtk# documentation and there is nothing about how to get
>    number of current text strings in the combo box

You need to check out the underlying TreeModel. Monodoc has fairly good
documentation of that class, including the one admittedly oddly named
IterNChildren () method. Here's a small boo example:

import Gtk from 'gtk-sharp'
Application.Init ()
w = Window ('test')
c = ComboBox.NewText ()

for v in ('cat', 'dog', 'shoe'):
	c.AppendText (v)

c.Changed += { print "${c.Model.IterNChildren ()}" }
w.Add (c)
w.ShowAll ()
Application.Run ()



Peter Johanson
<latexer at gentoo.org>

More information about the Gtk-sharp-list mailing list