Re: Signals for Gtk2::Ex::Simple::List
- From: muppet <scott asofyet org>
- To: gtk2-perl List <gtk-perl-list gnome org>
- Subject: Re: Signals for Gtk2::Ex::Simple::List
- Date: Fri, 25 Jan 2008 00:34:06 -0500
On Jan 22, 2008, at 11:01 AM, MICHAEL MCGINN wrote:
When I toggle the "toggle field" on or off I want to trigger a
signal to perform an action based on the data in one of the "text
fields" in that corresponding row.
SimpleList derives from Gtk2::TreeView, so all methods on a treeview
are available.
$slist->get_model->signal_connect (row_changed => sub {
my ($model, $path, $iter) = @_;
print "row_changed signal says ".$path->to_string." changed\n";
# you can cheat and use the path string as an index
# (but this actually involves more work under the hood)
print " [ ".join (", ", @{$slist->{data}[$path->to_string]})." ]\n";
# or go straight there with the model API
# (in perl, not specifying a column index means "all of them")
print " [ ".join (", ", $model->get ($iter))." ]\n";
print "\n";
});
(Note that since the SimpleList instance is merely a re-blessed
TreeView, not an actual Glib::Object::Subclass-made, GType-registered
subclass, SimpleList cannot create a new signal, such as row-index-
changed. Would be nice, though.)
--
If the monkey could type one keystroke every nanosecond, the expected
waiting time until the monkey types out Hamlet is so long that the
estimated age of the universe is insignificant by comparison ... this
is not a practical method for writing plays.
-- Gian-Carlo Rota
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]