Re: Check Gtk2::ListStore empty or not



integer = $tree_model->iter_n_children ($iter=undef)

Returns the number of children $iter has. If $iter is undef (or omitted) then returns the number of toplevel nodes.

with $list_store->iter_n_children(undef) you will know if is empty or not and the rows that it has throug a integer value.


The way of tadej showed is correct too.

David.

On Mon, Jul 27, 2009 at 1:49 PM, Tadej BorovÅak <tadeboro gmail com> wrote:
Hi.

I would use construct like this one:

--- CODE ---
my $iter = $list_store->get_iter_first;
if( $iter )
 Â# Get contents of first line
 Âmy @line = $list_store->get( $iter );
else
 Â# Add new line

--- CODE ---

This might not be the best way, but it should work.

Tadej

--
Tadej BorovÅak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]