[Glade-users] libglade - Associating a mode with an empty combo_box
- From: kbulgrien at worldnet.att.net (Kevin R. Bulgrien)
- Subject: [Glade-users] libglade - Associating a mode with an empty combo_box
- Date: Wed, 29 Aug 2007 01:38:07 -0500
Problem: An empty combo box is created in a window using glade-2. No
items are placed in the combo box because it will be filled at run-time.
In the glade file a couple combo boxes look like this:
...
<child>
<widget class="GtkComboBox" id="config_combobox_faceset">
<property name="width_request">170</property>
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
...
<child>
<widget class="GtkComboBox" id="config_combobox_theme">
<property name="width_request">170</property>
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
...
I see now that the combo box definitions are not identical after all.
One property is missing:
<property name="items" translatable="yes"></property>
This causes the combo box to be created as expected with a model. It is
non-obvious in glade-2 how to generate this property, and most difficult
that glade generated code did not require the XML file to have this
property set.
The combo box worked fine with generated code without the items property
so this difficulty is unique to libglade. I did the libglade conversion
and fell face first into the mess even though I made no modifications
whatsoever to the XML file or any code that dealt with the widget that
malfunctioned.
To get glade-2 to put the property line into the XML file, simply press
the ellipses [...] button next to the empty Items: list, then press OK
on the subsequent Edit Text Property dialog, and when the project is
saved, an items property is added to the combo box, and the model is
non-null. That seems pretty pedantic but perhaps there are reasons for
it that I do not understand due to my newness to the tool set. It feels
quite similar to a bug as I would have expected libglade and glade
generated code to operate identically for the same XML description.
The clue to look closer at the widget came from
http://lists.ximian.com/pipermail/glade-users/2006-November/003147.html
which I still do not quite understand with respect to dynamically created
items since I do not have to programmatically create the list store in
code.
Apologies for any wasted time the original post caused. It is pretty rough
to have overlooked that as many times as I looked over the code and XML file.
Kevin Bulgrien
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]