why button is hidden behind drawing area(win32)



Hello everyone.
I am a newbie of glib/gtk+. And I'm porting a app to win32.
Following code is compiled with ms vc7.1 + gdk2.8.x,
When I run it. I found the button is hidden behind the drawing_area
and  I can not got it displayed. Who can tell me why?
I've not tested the code under Linux.

Any help will be appreciated.


#include <gtk/gtk.h>

int main()
{
   GtkWidget *window;

   gtk_init (&argc, &argv);

   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

   GtkWidget* fixed = gtk_fixed_new();
   gtk_container_add(GTK_CONTAINER(window), fixed);
   gtk_widget_show(fixed);

   GtkWidget* drawing_area = gtk_drawing_area_new();
   gtk_drawing_area_size(GTK_DRAWING_AREA(drawing_area), 100, 100);

   // if I comment out this, the button will be displayed
   gtk_fixed_put(GTK_FIXED(fixed), drawing_area, 0, 0);

   gtk_widget_show(drawing_area);

   GtkWidget* btn_play = gtk_button_new_with_label("Connect");
   gtk_widget_set_usize(btn_play, 80,22);

   gtk_fixed_put(GTK_FIXED(fixed), btn_play, 15, 15);
   gtk_widget_show(btn_play);

   gtk_widget_show  (window);

   gtk_main ();

   return 0;
}



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