[Mono-list] setting combobox from gconf value

Loren Bandiera lorenb at mmgsecurity.com
Sat Sep 9 20:09:50 EDT 2006


Hi,

If you are working with known values in the ComboBox, then you could do
something like this:

switch (gconfValue) {

case "foo":
	comboBox.Active = 0;
	break;

case "bar":
	comboBox.Active = 1;
	break;

case "foobar":
	comboBox.Active = 2;
	break;
}

The store of a ComboBox is available through the Model property. To get
the current selection for example:

TreeIter iter;
if (comboBox.GetActiveIter (out iter)) {
	string name = (string) comboBox.Model.GetValue (iter, 0);
}

On Sun, 2006-09-10 at 11:47 +1200, Rob Brown-Bayliss wrote:
> Hi.
> 
> I am using monodevelop and stetic to build an app.
> 
> I have some comboboxes, with the text entered in the gui designer of
> monodevelop.  When the app starts I want to set tyhe vlaues from a key
> in gconf, and I assume I have to do this with combobbox.SetActiveIter.
> 
> But first I need to know the iter I want, and as far as I can see
> there is no way to get a list of iters from the widget.
> 
> I have seen some examples using liststores etc, but once again I cant
> see a way to get the liststore of a combobox built with stetic.
> 
> Any ideas or examples?
> 
> thanks.
> 
> -- 
> Rob 
-- 
Loren Bandiera <lorenb at mmgsecurity.com>
MMG Security, Inc.



More information about the Mono-list mailing list