Re: Getting column 2 in selected row of TreeView?

Emmanuele Bassi writes:
With 'clicked' I presume you're referring to a 'mouse event'.

If so, just connect the 'button_press_event' of the TreeView widget.
I've sent a code snippet on how to do this this week (monday or

Just 'cause this is earlier than Monday or Tuesday:

sub on_treeview1_button_press_event
    my ($widget, $event) = @_;

    my ($x,$y) = $event->get_coords;
    my ($path, $column, $px, $py) = $widget->get_path_at_pos($x,$y);
    my $treestore;
    $treestore = $widget->get_model();
    my $iter = $treestore->get_iter($path);

    my $stuff = $treestore->get_value($iter,...);


However, I've got a question that maybe can get answered before I dig
too much further here: Anyone got a quick sample on changing the
selection manually?

Specifically, I'm checking for button 3 in my button press event and
bringing up a pop-up menu. I'd really like to have the click propagate
first, but since I can't figure out how to make that work I'd love to
do a "If this is one of the selected nodes, use the selection,
otherwise change the selection to this node and use just this node".

Not quite sure how to pull that off.


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