Re: [gtk-list] GtkCList + gtk_menu_popup() = ???




On Fri, 18 Sep 1998, Sergei O. Naoumov wrote:
> 
> Hi!
> I want a pop-up menu to appear when a user clicks on a row in the CList.
> The tutorial says I have to do this:
> 
> gtk_signal_connect_object(GTK_OBJECT(widget), "event",
> 			  GTK_SIGNAL_FUNC (handler),
> 			  GTK_OBJECT(menu)); 
> 
> But if I put "event", it catches ANY event, so I can't draw in CList. If,
> however, I put "select_row" the program segfaults. Does anyone know how to
> marry CList and pop-up menus?
>

For a different menu on each row, look at gnome-utils/mini-utils/gw for an
example. For a very simple example look at gnome-utils/mini-utils/guname.

The basic answer is to connect to button_press_event; your callback should
take a GdkEventButton arg; in GdkEventButton you can get which button was
pressed and the coordinates. CList has a coordinates->row conversion
function if you care which row the pointer was over.

Havoc



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