setting focus in a CTree
- From: perl-gtk skydancer org uk (Pete Jordan)
- To: gtk-perl-list gnome org
- Subject: setting focus in a CTree
- Date: Fri, 28 Dec 2001 10:59 +0000 (GMT Standard Time)
Hi,
I'm moving the selection about a CTree using code (in response to user
keypresses) and need focus to match the selection.
The only method I've managed to find to do the job is set_focus_row, the
problem being that I don't know the selected row number when I need to do
this. I have a nasty workaround, using a linear search for the row, that
works fine (see below), but there *must* be a better way...
While I'm at it, is there any way to get the CTree object from one of its
CTreeNode components? I'd rather not have to store both in my Message
object.
sub go($):method {
my $message=shift;
my $ctree=$message->{threadtree};
my $node=$message->{threadnode};
$ctree->select($node);
$message->display;
$ctree->node_moveto($node, 0, 0.3, 0);
my $ptr=0;
while (my $search=$ctree->node_nth($ptr)) {
last if $search eq $node;
$ptr++;
}
$ctree->set_focus_row($ptr);
}
Pete Jordan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]