RE: [gtk-list] Re: Perl/Gtk: how to get the data from a Gtk::Lis

On 15-Apr-98 Kenneth Albanowski wrote:
> You can use the get_data and set_data methods on the listitems (although I
> don't believe those methods are much use at the moment, as they'll only
> let you store gtk_object types).
> The Perl approach is simply to store the data in the listitem:
>    for $item (@items) {
>      my $li = new Gtk::ListItem($item);
>      $li->{mydata} = ++$mydata;
>      $list->add($li);
>      $li->show;
>    }
>    $list->signal_connect('selection_changed' => \&sel_callback);
> -- 
> Kenneth Albanowski (, CIS: 70705,126)

Errg... it's errant to start changing object data, it's much better
to treat an object as an object, not a hash with methods.  Anyway,
there are better ways to go about this (read my previous post on
this thread).


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