[glade--]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]