Re: [gtk-list] Re: gtk_widget_size_allocate doesn't seem to change the size of my widgets in a GtkFixed container



Jason Trenouth wrote:


> > > Glade uses gtk_widget_set_usize() to change the size of widgets in a GtkFixed
> > > container. It works for me!
> >
> > Hmmm. Okay. Might it matter whether they were already realized or mapped?

It shouldn't. I think Glade uses it in both situations and it works.

 
> Oh and I probably should have said that I'm using GTK on Win32. Perhaps
> there's a bug in that back end?

Maybe, but I'd be a bit surprised, since it is fairly standard widget layout code.


I've attached a little test program. Each time you click the button it resizes the
other button in the fixed container. See if it works for you.

Damon

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

static void on_button_clicked (GtkWidget *widget, gpointer data);

GtkWidget *child;

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

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  vbox = gtk_vbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (window), vbox);
  
  fixed = gtk_fixed_new ();
  gtk_box_pack_start (GTK_BOX (vbox), fixed, TRUE, TRUE, 0);
  gtk_widget_set_usize (fixed, 300, 160);

  child = gtk_button_new_with_label ("Hello");
  gtk_fixed_put (GTK_FIXED (fixed), child, 10, 10);

  button = gtk_button_new_with_label ("Change Button Size");
  gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, TRUE, 0);
  gtk_signal_connect (GTK_OBJECT (button), "clicked",
                      GTK_SIGNAL_FUNC (on_button_clicked), NULL);

  gtk_widget_show_all (window);

  gtk_main ();
  return 0;
}

static void
on_button_clicked (GtkWidget *widget, gpointer data)
{
  gtk_widget_set_usize (child, rand () % 256 + 1, rand () % 128 + 1);
}


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