[glade--]Re: Bug in glade or glade--, label for Frame



Actually, it might be a bug in glade--.  I just decided to rerun my project as c (just after I sent that last message), and it generates the c code a little differently.  It calls gtk_frame_set_label_widget().

But, is glade doing this in a weird way?  Though, the gtk_frame_set_label_widget().function must exist for some reason, though it seems redundant with frame_set_label(), one takes a label widget with the text, the other takes the text for the label as its argument.

The question is, why create the extra label widget when you can just set the text for the frame label (assuming it doesn't internally create a label widget if you do not feed it one, which would then leave memory use, etc. in the same situation either way)?  

So, maybe this is a bug in glade-- for now, but maybe glade should handle this differently?  This seems like a good glade-list question maybe.

Mark

> 
> From: Mark Jones <mark jones106 verizon net>
> Date: 2002/10/24 Thu AM 02:55:39 CDT
> To: <glademm-list gnome org>
> Subject: Bug in glade or glade--, label for Frame
> 
> Christof,
> 
> With that glade file I sent to you the other day, after generation of code I get this warning on startup:
> (project11:31072): Gtk-WARNING **: Attempting to add a widget with type gtkmm__GtkLabel to a gtkmm__GtkFrame, but as a GtkBin subclass a gtkmm__GtkFrame can only contain one widget at a time; it already contains a widget of type gtkmm__GtkScrolledWindow
> 
> So, I looked into this some.  First, the code being generated by glade-- is not correct, except I think that glade is misguiding it actually.  This is best judged by you probably.
> 
> This doc describes how to set the label for a frame:
> http://gtkmm.sourceforge.net/gtkmm2/docs/tutorial/html/ch07.html#sec-Frames
> 
>   /* Set the frames label */
>   frame->set_label( "GTK+ Frame Widget" );
> 
> But, glade-- is creating an actual label widget for it, and attempting to stuff it in with the item that is supposed to be inside the frame (scrolled window it this case):
>    frame1->set_label_align(0,0.5);
>    frame1->add(*scrolledwindow3);
>    frame1->add(*label2);
> 
> So I looked inside the .glade file to see if it was misguiding it, and I think it just might be.  The structure of the glade file at this point is:
> 
> <widget class="GtkFrame" id="frame1">
> ...properties
> 
>     <child>
>         <widget class="GtkScrolledWindow" id="scrolledwindow3">
>         ...properties
> 
>             <child>
> 	        <widget class="GtkTextView" id="textview2">
>                 ...properties
> 	        </widget>
>             </child>
>         </widget>
>     </child>
> 
>     <child>
>         <widget class="GtkLabel" id="label2">
>         <property name="label" translatable="yes">whatever</property>
>         ...properties
>         </widget>
>         <packing>
>           <property name="type">label_item</property>
>         </packing>
>     </child>
> </widget>
> 
> The way glade is writing the XML file, I think it implies adding another widget to the frame.  That is why I think glade is at fault and not glade--.
> 
> I think it should be:
> <widget class="GtkFrame" id="frame1">
> ...properties
>     <property name="label">whatever</property>
> 
>     <child>
>         <widget class="GtkScrolledWindow" id="scrolledwindow3">
>             ...properties
> 
>             <child>
> 	        <widget class="GtkTextView" id="textview2">
>                 ...properties
> 	        </widget>
>             </child>
>         </widget>
>     </child>
> 
> </widget>
> 
> Then glade-- can take that property and write the code:
>   frame1->set_label( "whatever" );
> 
> What do you think?
> 
> Mark
> 
> 
> 




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