Dynamic Context Popup menus(ARGHHHH!!!)

Hello all,

How do you display a dynamic context popup menu?  I have a GtkCList with
columns...  I want to be able to click on the column and have a context
menu appear.  I need to use a event box for each column and the call a
function display_popup_menu(gint column).  My problem is that whenever I
get into one of the signal handlers... the column is ALWAYS invalid.  3
Developers have looked at this code and nobody understand why this does
NOT work!!!

Sample code:

GtkObject create_popup_menu(gint column)
{ // Create my context menu
  // Attach signal handlers
  gtk_signal_connect (GTK_OBJECT (sort_ascending1), "activate",
                      GTK_SIGNAL_FUNC (on_sort_ascending1_activate),
  return popupmenu;

display_popup_menu                    (GtkWidget      *widget,
                                       GdkEventButton *event,
                                       gint           column)
  mPopupMenu = create_popup_menu(column);
  gtk_menu_popup(GTK_MENU (mPopupMenu), NULL, NULL, NULL, NULL,
                 event->button, event->time);

on_eventbox1_button_press_event        (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data)
  return display_popup_menu(widget, event, 0);

// gpointer = void *
on_sort_ascending1_activate            (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
  gint column;
cout << "IN SORT ASCENDING CODE..." << endl;
  // Sort the column... 
  column = *((gint *) user_data); // <---  THIS NEVER WORKS!!! ALWAYS

I hope somebody can help...  Sincerely,

Kristopher Kycia

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