Re: Extracting data from SimpleList
- From: muppet <scott asofyet org>
- To: Gtk-Perl-List <gtk-perl-list gnome org>
- Subject: Re: Extracting data from SimpleList
- Date: Thu, 6 Jan 2005 21:33:09 -0500
On Jan 6, 2005, at 8:30 PM, Ross McFarland wrote:
On Thu, 2005-01-06 at 20:16, Scott wrote:
Using the wonderful SimpleList to bypass dealing with the TreeView
stuff is pretty handy. However, how does one get the data back out
of the list? I've attached a small example where I am printing out
the indices very easily, but I see no docs on accessing the data,
except for get_row_data_from_path.
...because you don't need to do anything special. Just use the same
tied data structure you used to put the data into the SimpleList to get
it out.
How do I get the path?
In some instances, you'll get a path from a signal handler.
get_row_data_from_path() converts the path to an index and does
$slist->{data}[$index] (fetch all columns at row $index) for you.
$slist->{data} as a normal perl array reference:
$slist->{data}[42][0]; # 42nd row, first column
$slist->{data}[42][1]; # 42nd row, second column
$slist->{data}[23][3]; # 23rd row, 3rd column
(er, make that 43rd row, 24th row, and fourth column. damned
zero-indexing. ;-)
if i'm not misunderstanding your question that should be all there is
to it.
hence *Simple*List.
--
Examples really shouldn't include unexploded ordnance.
-- Joe Smith, referring to an example program i wrote.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]