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

Gennadiy Donchyts don at env.com.ua
Sat Dec 10 18:11:08 EST 2005

Hi Peter, thatnks for help, I also saw the Model property there and supposed
that it should have it but
from properties there is NColumns but no NRows .... now I've also
spotted the method you've mentioned :).

... sometimes it is not very intuitive/logical in Gtk#, I'm wondering if it
is going to be refactored in the future to something which is
very clear even without documentation, using common collection interfaces
like ICollection, IList, etc., other common patterns,
are there some plans to make such a redesign for Gtk# in the future??? (Gtk#

Checking Gtk+ documentation I would expect all methods like gtk_tree_model_*
iter*_xxx to transfer into something like IList:

TreeModel: IList

gtk_tree_model_iter_has_child   => IList.Contains(TreeModelRow row);
gtk_tree_model_iter_n_children  => IList.Count
gtk_tree_model_iter_nth_child   => TreeModelRow IList.index[int n]

it would be just a bit mode .net-ish and also it would be much more usefult
for all other collection-related classes/libraries
which can use it (NHibernate, ObjectViews, data binding, etc.), since in
Gtk+ everything is quite similar it would require
to make only a several such transformation/wrapping patterns.


On 12/10/05, Peter Johanson <latexer at gentoo.org> wrote:
> 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:
> <code>
> 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 ()
> </code>
> hth,
> -pete
> --
> Peter Johanson
> <latexer at gentoo.org>
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20051211/fa39877f/attachment.html

More information about the Gtk-sharp-list mailing list