Re: [gtk-list] using a callback as a normal function



> static GtkItemFactoryEntry menu_items[] =
> {
>      {"/_File", NULL, NULL, 0, "<Branch>"},
>      {"/File/_New", "<control>N", NULL, 0, NULL},
>      {"/File/_Open", "<control>O", file_open, 0, NULL},
>      ....
> };
> 
> how do I pass arguments to this?

Pass arguments to your callback through argument four.  To pass the value,
VALUE, to your function, use

static GtkItemFactoryEntry menu_items[] =
{
		 ...
     {"/File/_Open", "<control>O", file_open, gpointer(VALUE), NULL},
     ....
};

This is explained in tutorial 1.2, section 13.4.

Best Wishes,  --josh

----------------------------------------------------------------
                       Joshua Richardson
Dept. Cognitive and Neural Systems / Center for Adaptive Systems
                       Boston University
----------------------------------------------------------------




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