how to catch a click onto a non editabl text cell in a TreeView?



Bruno Boettcher writes:
is there a way to connect the activate signal to those cells? or what
signal can i use that is triggered when the cell is clicked?

this should work on lists too, I use it on a treeview, something like:


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

    # Check for button 1
    if ($event->type() eq 'button-press' 
        && $event->button() == 1)
    {
        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);

...

And when I first tried this, I was having trouble getting Glade to
connect that signal, so I had to attach it manually:

$treeview->signal_connect(button_press_event =>  \&on_treeview1_button_press_event);


Dan




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