setting focus in a CTree


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 

sub go($):method {
  my $message=shift;
  my $ctree=$message->{threadtree};
  my $node=$message->{threadnode};
  $ctree->node_moveto($node, 0, 0.3, 0);
  my $ptr=0;

  while (my $search=$ctree->node_nth($ptr)) {
    last if $search eq $node;


Pete Jordan

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