Re: [gtk-list] Gtk--: Problems with CList & Popup menu



robert_gasch@peoplesoft.com wrote:
> 
> Hi,
> 
> my CList widget is slowly maturing, but I'm having trouble understanding
> how to use the GdkEvent * (passed into some of the *_impl methods)
> in conjunction with a popup. Let me elaborate:
> 
> A typical *_impl function for CList looks like this:
>      virtual void select_row_impl (gint p1, gint p2, GdkEvent *e);
> 
> However, in this method I want to create a popup menu which I've gotten
> to work (somewhere else in my program)  using a call like this:
>      d_menuHandle->popup (NULL, NULL, e->button, e->time);
> where the type of e is GdkEventButton.
> 
> Since GdkEvent doesn't contain the button and time fields, I'm a bit
> stuck at this point. I tried casting but that didn't work, so I guess I'm
> overlooking something here. How can I take a GdkEvent * and
> make a GdkEventButton from it so that I can use it with popup?
> 
> Thanks a lot
> --> Robert
> 
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null



I don't know about Gtk--, but in C I do this:

int cbSelectTable(GtkWidget *lista, int row, int col, GdkEventButton *ev,
gpointer data);

gtk_signal_connect_after(GTK_OBJECT(lista), "select_row",
GTK_SIGNAL_FUNC(cbSelectTable), NULL);


As you see, I can treat the GdkEvent as a GdkEventButton (GdkEvent is a "union"
type) which has time and button fields.



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