Re: gtk break the code into files programming question




On Tue, 2 Jun 1998, Travis Loyd wrote:
> 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.
> 

Need more info. What do you mean "fails"? What do you do in make_menu?

container_add needs a GtkWidget * as the second argument, so you will need
to cast to that if necessary to avoid compiler warnings. Otherwise though
the above should work unless you have a mistake in make_menu.

Havoc Pennington ==== http://pobox.com/~hp






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