Re: GtkTreeView: How do I detect right-click?



Hi,

Guy Rouillier wrote:

Ang Bodhi wrote:

Hi,

I have a GtkTreeView widget that I would like to detect the mouse
button right-click, how can I do that? In Gtk 1.2, I used to be able
to connect to a button_press_event signal of a GtkTreeItem widget.


Did you search archives before posting?  I just answered this 5 days ago:

Sorry, I did a quick search with bad choice of keywords.

gtk_menu_new();
gtk_menu_popup();

In order to know to kick this off, you'll have to gtk_signal_connect on the "popup_menu" signal.

Thanks, I didn't realize there's a "popup_menu" signal. After trying it, I find
that the signal "popup_menu" does not work with the GtkTreeView widget.

I notice the tests/testiconview program use the popup_menu signal
on GtkIconView widget as well, but its popup menu works only by
connecting to the button_press_event signal of GtkIconView widget.
If I comment out the button_press_event signal connection, the program
would fail to popup the menu. It actually rely on the event's position to
determine which icon is chosen.

Regards,
Bodhi




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