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# 3.0).
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.
--Gena
On 12/10/05, Peter Johanson <[EMAIL PROTECTED]> 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
<[EMAIL PROTECTED]>
_______________________________________________
Gtk-sharp-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
_______________________________________________ Gtk-sharp-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
