Dynamic Context Popup menus(ARGHHHH!!!)
- From: Kristopher Kycia <kkycia hydrosoftenergie com>
- To: gtk-list gnome org
- Subject: Dynamic Context Popup menus(ARGHHHH!!!)
- Date: Fri, 18 Aug 2000 14:02:47 -0400
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),
&column);
...
return popupmenu;
}
gboolean
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);
}
gboolean
on_eventbox1_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
return display_popup_menu(widget, event, 0);
}
// gpointer = void *
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
RETURNS SOME HUGE NUMBER! WHY?
}
I hope somebody can help... Sincerely,
Kristopher Kycia
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]