[bug] in showing windows (was: Re: gtk-timj-970919.patch) (fwd)



hi all,

apended is a message i got from Dan Stromberg regarding a problem
with showing windows in gtk...

i played a little with his source and found this out:



#include <gtk/gtk.h>
#include <string.h>

/* defines for PLACE:
 * 1) window size: 200x200, fully filled with a button that says "foo"
 * 2) window size: 200x200, totaly empty
 * 3) window size: ca 15x21 (font dependent), button "foo" in it
*/
#define PLACE    1

int main (int argc, char *argv[])
   {
   GtkWidget *window;
   GtkWidget *button;
   GtkWidget *box;

   gtk_init (&argc, &argv);

   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   
#if PLACE == 1
   gtk_widget_show (window);
#endif
   
   box = gtk_vbox_new (FALSE, 0);
   

   gtk_widget_show (GTK_WIDGET (box));
   gtk_container_add (GTK_CONTAINER (window), box);

#if PLACE == 2
   gtk_widget_show (window);
#endif

   button = gtk_button_new_with_label("foo");
   gtk_widget_show(button);
   
   gtk_container_add (GTK_CONTAINER (box), button);
   
#if PLACE == 3
   gtk_widget_show (window);
#endif

   gtk_main ();
   return 0;
   }



strange isn't it? 

---
ciaoTJ

here goes dan's message:

---------- Forwarded message ----------
Date: Sat, 20 Sep 1997 20:42:17 -0700
From: Dan Stromberg <strombrg@hydra.acs.uci.edu>
To: Tim Janik <timj@psynet.net>
Subject: Re: [gtk-list] gtk-timj-970919.patch


Tim Janik wrote:
> 
> On Sat, 20 Sep 1997, Dan Stromberg wrote:
> 
> > Never mind, I found it.
> >
> though, i put it up into your incoming dir...

Thanks.

> > Sadly, it didn't solve my problem.
> 
> what is your problem, could you give some sample code for your
> problem? (i may then forward this to gtk-list, people are *very*
> helpfull there...).

I'm glad you asked.

BTW, I sent a message about this to the list earlier, but it apparently
didn't make it thru the list server.

Below are two programs.  The first works with gtk+970828, but not
gtk+970916.  The second program is similar to the first, but works with
both of these gtk releases.

In short, it appears that a button within a table within a box within a
window has problems (the button's label isn't visible), but a button
within a table within a window is ok.  

----------------------------------------------------------------------

#include <gtk/gtk.h>
#include <string.h>

int main (int argc, char *argv[])
   {
   GtkWidget *window;
   GtkWidget *box1;
   GtkWidget *button;
   GtkWidget *table;

   gtk_init (&argc, &argv);

   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

   box1 = gtk_vbox_new (FALSE, 0);
   gtk_widget_show (box1);
   gtk_container_add (GTK_CONTAINER (window), box1);

   gtk_widget_show (window);

   table = gtk_table_new (8192, 1, FALSE);
   gtk_table_set_row_spacing (GTK_TABLE (table), 0, 1);
   gtk_widget_show (table);

   gtk_box_pack_start(GTK_BOX(box1), table, TRUE, TRUE, 0);
   button = gtk_button_new_with_label("foo");
   gtk_table_attach (GTK_TABLE(table),button,
      0,1,0,1,GTK_EXPAND|GTK_FILL,GTK_EXPAND|GTK_FILL,0,0);
   gtk_widget_show(button);
   gtk_main ();
   return 0;
   }
-----------------------------------------------------------------------
#include <gtk/gtk.h>
#include <string.h>

int main (int argc, char *argv[])
   {
   GtkWidget *window;
   GtkWidget *button;
   GtkWidget *table;

   gtk_init (&argc, &argv);

   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

   gtk_widget_show (window);

   table = gtk_table_new (8192, 1, FALSE);
   gtk_table_set_row_spacing (GTK_TABLE (table), 0, 1);
   gtk_widget_show (table);

   gtk_container_add(GTK_CONTAINER(window), table);
   button = gtk_button_new_with_label("foo");
   gtk_table_attach (GTK_TABLE(table),button,
      0,1,0,1,GTK_EXPAND|GTK_FILL,GTK_EXPAND|GTK_FILL,0,0);
   gtk_widget_show(button);
   gtk_main ();
   return 0;
   }



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