Re: implementing a right-click popup in a treeview



On 10/11/07, Ferenc Gerlits <fgerlits gmail com> wrote:
> Hi,
>
> I have a TreeView in which I would like to implement a right-click
> context menu.  For single selection, this is fine: I connect_notify() to
> the signal_button_press_event() signal, and find out which row the user
> wants from event->x and event->y.
>
> However, I would like to have this for multiple selection, and I can't
> figure out how to do it.  The problem is that after my event handler,
> the standard event handler is called as well, which selects the row the
> user right-clicked on.  My event handler gets the correct selection that
> was before the right-click, and I can apply the action to that, so it
> works as expected, but to the user it looks wrong, because the selection
> shown on the screen is now different.
>
> Is there any way to tell the Gtk engine not to call the standard event
> handler for right-clicks on this TreeView?  I think the normal way would
> be to return 'true' from my event handler, but connect_notify() expects
> a void method, so I can't do that.

can't you just pass a 'false' as the second parameter to connect() to
connect the signal handler before instead of after.  Then if you
return true, the default signal handler should not be called.

-- 
jonner



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