Re: [gtk-list] Gtk--: Trouble with CList event _imp functions



RNG wrote:
> 
[...]
> I want to bind a popup menu to my clist which is activated by the left
> mouse button. So far so good. But the button_press_event_impl method
> receives a GdkEventButton * as it's only parameter.
> 
> Given the GdkEventButton argument, how can I determine which row and
> column the user actually clicked on?

Hi, in perl I use something like this.
----------------8<-------------
my $sel = $ctree->selection;
if ($e->{'button'} == 3) {
    my $menu = new menu1;
    $menu->TOPLEVEL->popup(undef, undef, 0, 0);
} else {
    ($row, $col) = $ctree->get_selection_info($e->{'x'}, $e->{'y'});
    if ($sel) {
        print "We have a selection\n";
    }
    print "We have clicked on '".$ctree->get_text($row, $col)."'\n";
    print "Event was caused by button $e->{'button'}\n";
}
----------------8<-------------
menu1 is a perl class that constructs a popup menu and has method TOPLEVEL
that returns the toplevel widget, surprisingly.

HTH, Dermot



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