Setting size of widget problem...



Hello,
   I was using gtk_widget_set_usize to set the size of some widgets, but
the only problem I see is that it sets a minimum size restriction of the
widget. In an app of mine, before it is closed it saves the size of some
widgets, and next time it starts up, it'll retrieve this size, and use
gtk_widget_set_usize to set the sizes back. So, if the user maximizes the
program, and then closes it, next time they start it back up, it is still
this size, and they can't shrink it. I have tried setting the values of
the allocation fields for the widget, and doing a gtk_widget_quue_resize,
but this don't do anything. What is the proper way for me to do this? I
enclosed a small code sample that demonstrates what I am talking about.

#include <gtk/gtk.h>

gint delete_event (GtkWidget *widget, GdkEvent *event, gpointer data);
void destroy (GtkWidget *widget, gpointer data);

int main (int argc, char *argv[]) {
   GtkWidget *window, *label;
   
   gtk_init (&argc, &argv);
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_signal_connect (GTK_OBJECT (window), "delete_event",
   	GTK_SIGNAL_FUNC (delete_event), NULL);
   gtk_signal_connect (GTK_OBJECT (window), "destroy", 
   	GTK_SIGNAL_FUNC (destroy), NULL);
              

   label = gtk_label_new ("Can't resize this window any smaller");
   gtk_widget_set_usize (label, 300, 300);
   gtk_container_add (GTK_CONTAINER (window), label);
   gtk_widget_show (label);
   
   gtk_widget_show (window);
   
   gtk_main ();
   return (0);
}

gint delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) {
   return (FALSE);
}

void destroy (GtkWidget *widget, gpointer data) {
   gtk_main_quit ();
}

Thank you for your time,
Brian



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