Re: Check Gtk2::ListStore empty or not
- From: Peter E Dennis <peter edwin dennis gmail com>
- To: anguila <anguila gmail com>
- Cc: "gtk-perl-list gnome org List" <gtk-perl-list gnome org>
- Subject: Re: Check Gtk2::ListStore empty or not
- Date: Tue, 28 Jul 2009 08:00:58 +1000
2009/7/27 anguila <anguila gmail com>:
integer = $tree_model->iter_n_children ($iter=undef)
$iter (Gtk2::TreeIter or 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
Thank you both for the suggestions. I will try them out and see how I go.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]