Re: Problems with GtkFrame
- From: Micah Carrick <email micahcarrick com>
- To: gtk mailing list <gtk-list gnome org>
- Subject: Re: Problems with GtkFrame
- Date: Fri, 19 Jan 2007 17:42:55 -0800
Someone correct me if I'm wrong...
The GtkFrame will set the widget to NULL if you set label to NULL. When 
GtkFrame is initialized, the label widget is NULL at first and later is 
set to a GtkLabel if you passed a string to gtk_frame_new(). If you use 
an empty string "" it is not null, and the GtkLabel will be used but 
contain an empty string.
In my experience, both of these will create the frame, however, the 
first one will have an empty GtkLabel and the latter will have NULL as 
the label widget:
   frame = g_object_new (GTK_TYPE_FRAME,
      "label", ""
       "shadow-type", GTK_SHADOW_ETCHED_IN,
       "border-width", 10,
       NULL);
   frame = g_object_new (GTK_TYPE_FRAME,
       "shadow-type", GTK_SHADOW_ETCHED_IN,
       "border-width", 10,
       NULL);
The first is equivalent to this:
   frame = gtk_frame_new ("");
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
   gtk_container_set_border_width  (GTK_CONTAINER (frame), 10);
And the second equivalent to:
   frame = gtk_frame_new (NULL);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
   gtk_container_set_border_width  (GTK_CONTAINER (frame), 10);
- Micah Carrick
 Freelance Developer
 http://www.micahcarrick.com | http://www.gtkforums.com
Michael Ott wrote:
Hi!
I write a small application which show a small window. And this a
GtkFrame. And this does not work correct. Here is my source code
--snip--
	gtk_init(&argc, &argv);
	window = g_object_new(GTK_TYPE_WINDOW,
						  "title", PACKAGE_STRING,
						  "type", GTK_WINDOW_TOPLEVEL,
						  "resizable", FALSE,
						  "window-position", GTK_WIN_POS_CENTER,
						  NULL);
	frame = g_object_new(GTK_TYPE_FRAME,
						"label", "",
						"shadow-type", GTK_SHADOW_ETCHED_IN,
						"border-width", 10,
						NULL);
	gtk_container_add(GTK_CONTAINER(window), frame);
	vbox = g_object_new(GTK_TYPE_VBOX,
						"homogeneous", FALSE,
						"spacing", 5,
						"border-width", 5,
						NULL);
	gtk_container_add(GTK_CONTAINER(frame), vbox);
	label = g_object_new(GTK_TYPE_LABEL,
						"label", " Searching for devices ",
						NULL);
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 2);
	gtk_widget_show_all(window);
	usleep(100000);
	while (gtk_events_pending()) {
		gtk_main_iteration();
	}
--snap--
frame = g_object_new(GTK_TYPE_FRAME, "label", "",
I need the empty label to get this frame to work. Why that?
OS: Debian Etch (testing)
Gtk+ 2.8.20
In Debian SID it works
CU        
         
  Michael  
          
  
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]