[gtk-server] Re: Glade & comboboxes
- From: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
- To: gtk-server@xxxxxxxxxxxxx
- Date: Mon, 01 Sep 2008 15:21:47 +0200
Hi,
The Combobox widget is a complicated widget, for which you cannot set
all properties using Glade. Therefore it is inevitable to set some
properties in the client program. It is similar to setting up a list
widget.
If the combobox is embedded in a Glade file, probably you have to do
it like this:
1) Create Glade file with combobox
2) In your client program, create a treemodel with 1 column (compliant
with current definition in configfile):
model = gtk_list_store_new(1, "G_TYPE_STRING")
Instead of "G_TYPE_STRING" you can also use the value '64'.
3) Set the combobox to this model:
gtk_combo_box_set_model (combox, model)
4) Populate the model:
iter = gtk_server_opaque()
gtk_list_store_append(model, iter)
gtk_list_store_set(model, iter, 0, "My data", -1)
gtk_list_store_append(model, iter)
gtk_list_store_set(model, iter, 0, "More data", -1)
gtk_list_store_append(model, iter)
gtk_list_store_set(model, iter, 0, "Other data", -1)
...and so on.
5) Show widget
The calls 'gtk_combo_box_append_text ()' etc. only work when you have
created the combobox in the client program with
'gtk_combo_box_new_text()'.
Please let me know if this works for you,
Peter
Quoting Erik Winkels <euqirea@xxxxxxxxx>:
Hello,
Does anyone have experience using comboboxes created with Glade and
using them through gtk-server? If so, could you paste a short
example?
I've created an interface in Glade and it can set and get values
from normal entries but if I do a gtk_entry_set_text on the combobox
nothing happens. Same for gtk_combo_box_append_text.
I'm going to try creating the box directly from code like in some of
the example on gtk-server.org, but I would prefer the Glade
approach to work.
Erik
--
http://www.gtk-server.org
- References:
- [gtk-server] Glade & comboboxes
- From: Erik Winkels
Other related posts:
- » [gtk-server] Glade & comboboxes
- » [gtk-server] Re: Glade & comboboxes
Hello,Does anyone have experience using comboboxes created with Glade and using them through gtk-server? If so, could you paste a short example?
I've created an interface in Glade and it can set and get values from normal entries but if I do a gtk_entry_set_text on the combobox nothing happens. Same for gtk_combo_box_append_text.
I'm going to try creating the box directly from code like in some of the example on gtk-server.org, but I would prefer the Glade approach to work.
Erik
- [gtk-server] Glade & comboboxes
- From: Erik Winkels