signal_connect vs signal_connect_after issues



Hi all.

I'm building a context-sensitive menu for right-button clicks in a treeview.

If I go:

$treeview->signal_connect( button_press_event => sub { $self->on_tree_click( @_ ) } );

 ... I get the click events, but I'll often get the wrong iter when I query the model. I believe this is because at the time of the click, gtk hasn't had time to catch up with where exactly I've clicked ... and that the solution is to use 'signal_connect_after'. However when I do:

$treeview->signal_connect_after( button_press_event => sub { $self->on_tree_click( @_ ) } );

 ... I *only* get double-click events in on_tree_click() ... ie neither single-clicking with the left or right button triggers this code at all. Why would that be?

As a work-around, I've tried adding:

Gtk3::main while ( Gtk3::events_pending() );

 ... inside on_tree_click() ... but this doesn't help.

Ideas anyone?

Dan


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