Oi Paulinho,

cbFiltro.Active = 1; // index (pt_BR: apenas por posição) zero-based.

Property ActiveText has only the 'get' acessor (so it is readonly), so...

In order to select by value you'll need to iterate through the
ListStore searching for it (as it may have been reordered) and
counting up to find it's positional index.

<rant>
Sometimes I miss WinForms Combos' simplicity when dealing with GTK#
versions'  flexibility that normally means larger, and more complex,
code.
</rant>

:)

On 6/18/05, Paulinho <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> I need to set a item in ComboBox, How i do that ?
> 
> In Web i just make this:
> myCombo.SelectedValue = "2" , automatically myCombo show me "Description
> of Option #2"
> sorry i'm novice in GTK# client applications
> 
> 
> my code:
> 
> CellRendererText descricao = new CellRendererText ();
> CellRendererText id          = new CellRendererText ();
> 
> comboBoxStore = new ListStore (typeof (string), typeof (string));
> cbFiltro.Model = comboBoxStore;
> 
> cbFiltro.PackStart (descricao, false);
> 
> cbFiltro.AddAttribute (descricao, "text"  , 0);
> 
> comboBoxStore.AppendValues("Option #1", "1");
> comboBoxStore.AppendValues("Option #2", "2");
> comboBoxStore.AppendValues("Option #3", "3");
> 
> ...
> ...
> 
> string mySelection = "2";
> 
> ???
> 
> 
> How to set the row of ListStore or ComboBox using a value into variable
> "mySelection" ?
> 
> 
> Magalhaes
> 
> /* Sorry my english */
> _______________________________________________
> Gtk-sharp-list maillist  -  [email protected]
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> 


-- 
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes. 
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
It hurts!
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to