Getting column 2 in selected row of TreeView?
- From: Dan Lyke <danlyke flutterby com>
- To: ArtÅras Ålajus <x11 h2o pieva net>
- Cc: gtk-perl-list gnome org
- Subject: Getting column 2 in selected row of TreeView?
- Date: Wed, 10 Dec 2003 08:21:56 -0800
Art$,1!+(Bras $,1! (Blajus writes:
I need to get column 2 data (the nick) from row i clicked on with
mouse button. The events are fine, i just don't get how to get
selection?
I use the "selection_changed" callback. I set it up manually:
my $select = $treeview->get_selection();
$select->set_mode('extended');
$select->signal_connect(changed =>
sub { on_treeview1_selection_changed($select, $treeview, $treestore)});
And then you can look at your list when it changes:
sub on_treeview1_selection_changed
{
my ($selection, $treeview, $treestore) = @_;
my @rows = $selection->get_selected_rows();
print "Selection changed\n";
foreach (@rows)
{
my $iter;
$iter = $treestore->get_iter($_);
print " ".$treestore->get($iter, 0)."\n";
}
}
Also i haven't made up my mind how to make another window from
gladexml file.
I haven't tried this yet, but in
http://mail.gnome.org/archives/gtk-perl-list/2003-October/msg00106.html
James Curbo said that you can get GladeXML to build you only the
window you asked for with:
$gladexml = Gtk2::GladeXML->new('my.glade', 'window1');
Haven't tested this yet. Of course if eventually you're going to
package the XML in a single Perl file as Muppet has shown, there's no
reason not to start out with separate glade files.
Dan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]