Re: ComboBox on Windows application

Alf Stockton wrote:

I have a screen already built using Glade and a whole bunch of code
that now needs maintaining.
Is it recommended that I carry on using Glade?

There are no alternatives for GTK+, except if you're willing to code
either C source or XML by hand to design your GUI.

Glade has built an interface.c that I now need to alter to get a 
combobox to display a number of entries I will retrieve from a SQL 
database, however a comment at the top of interface.c says  "DO NOT
EDIT THIS FILE - it is generated by Glade".
Recommendations please.

You don't need to alter interface.c. You NEVER need to! interface.c is
just a read-only blueprint of your GUI. It mainly describes what widgets
and windows there are and how they are layouted. As a convenience
option, Glade allows to populate combo boxes and option menus with some
predefined list items. This feature should be used for simple and
constant lists of items only, though. Don't use it for combo boxes which
are to receive changed content frequently.

If you use old compatible GtkCombo, gtk_combo_set_popdown_strings () is
what you're looking for. For newer GtkComboBox (since GTK+ 2.4) a bunch
of functions starting with gtk_combo_box_append_text () is what you can
use. Have a look at the respective class descriptions in the GTK+ API
docs. There you'll also find methods to delete contents from combo boxes
prior to refilling them again with new database result items.

manipulate your GtkCombo(Boxe)s either in any of your callback functions
in callback.c or, even better, in any of your own source files. But
never edit interface.c, indeed! You never need to.

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