Perl-Gtk.6123: Using CTree..



I've got a CTree widget. Code snippet below. Certainly there is a better way
to get the @titles then separate calls to each column? I've tried
variations.. Eg: get_node_info, get_data, get_row_data, etc. etc. 

Plus.. Do you see any problem with the way I've done the selection/double
click.. I'm a fairly new Gtk user. (But definitely a lover! or luster anyway
;)

Any help would be much appreciated!
Shawn Ferris
Oracle DBA - Time Warner Telecom

---- SNIP
$ctree->new Gtk::CTree(4,0);
  
  # Set the row selected for the double click..
  $ctree->signal_connect('select_row' => sub {
    $selection{'row'}=$_[1];
  });
  
  # Read the data on double click
  $ctree->signal_connect('button_press_event' => sub {
    my($tree,$event)=@_;
    my($user,$type,$name);

    if ( $event->{type} eq '2button_press') {
      ($user,$type,$name)=(
        $tree->get_text($selection{'row'},1),
        $tree->get_text($selection{'row'},2),
        $tree->get_text($selection{'row'},3),
      );
      print "--$name--\n";
    }

  });  

  # Add a test node..
  $tree->insert_node(
    $sibling,
    undef,
    ['a','b','c','d']
    0,
    undef,
    undef,
    undef,
    undef,
    0,
    0,
  );
---- SNIP



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