Re: [gtk-list] gtk break the code into files programming question




lelandg@usa.net said:
> In attempting to break up my code I ran into a problem I don't know 
> how to solve. In a separate file I create a menu bar and then I want 
> to return it. Where the menu bar is created the return value is 
> GtkWidget* but this attempt in the parent file fails.

>         menu_bar = GTK_MENU_BAR( make_menu() ); gtk_container_add(GTK_
> CONTAINER(window), menu_bar); gtk_widget_show(window);

> If I declare menu_bar in the parent file as GtkMenuBar the assignment 
> works but then the gtk_container_add fails.

> How can I do this? 

One approach that I've been using is to create a struct which has all the 
GtkWidgets & related data in it.  I declare these in a header to each 
independent c source file, generate the display in the support code & return 
the struct.

Best

-- 
Rick Forrister                 <Richard.Forrister@jpl.nasa.gov>

Opera: Greek word meaning "death by music".
		--Anonymous




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