Re: acces to a member of the principal widget



On 3/27/06, Jerome Le Saux <sidcpc gmail com> wrote:
Hi,
I looked for  days my error, and I found it ;).

in a menu bar I add item. This item open an gtk_file_chooser_dialog.
In the callback of my main I give as argument the pointer of my mani widget
pWindow.
But how can I access to my list, which is add by a gtk_add_container to my
pWindow widget ?.

{
pWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
...
DirList = gtk_clist_new_with_titles (3, DirTitles);
 g_signal_connect_swapped(G_OBJECT(pMenuItem), "activate",
G_CALLBACK(OnFile), (GtkWidget*) pWindow);
....
gtk_container_add (GTK_CONTAINER (scrolled_window), DirList);

}

void OnFile ( gpointer data )
{
 GtkWidget *pFileSelection;
    GtkWidget *pDialog;
    GtkWidget *pParent;
    gchar *sChemin;
 pParent = GTK_WIDGET(data);

.....

// Now I would like to access to my DirList Widget ? //
}

Can you tell me if it exists macros to access to member of the principal
widget ?

Hello,
You'd better connect with g_signal_connect() like:

g_signal_connect (pMenuItem, "activate", G_CALLBACK (OnFile), pWindow);

and change the OnFile callback like:

static void
OnFile (GtkMenuItem *menu_item, GtkWidget *window)
{
/* ... */
}

Olexiy


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