[Gtk-sharp-list] ComboBoxEntry TextColumn

Paulo Pires paulo.pires at vodafone.pt
Mon May 8 14:49:34 EDT 2006


If you need to get the active entry selected just store.GetActiveIter
(out iter) and parse it through the defined collumns.

--ppires
Jorge Cabello wrote:
> I was trying to use the ComboBoxEntry class instead of ComboBox one. 
> All is fine if I write the following code:
>   ListStore store = new ListStore (typeof(int), typeof(string));
>   store.AppendValues (1, "Test"); 
>
>   Container.Add (new ComboBoxEntry(store,1));
>   Container.ShowAll();
>
> But I was trying to set a new model to an already created ComboBoxEntry
> and when I try to set the new TextColumn I get the gtk critical message.
>
> El lun, 08-05-2006 a las 19:12 +0100, Paulo Pires escribió:
>   
>> Hi,
>>
>> Where are your CellRendererXXX? I advise you to look for ComboBox examples.
>>
>> <snippet>
>> TreeIter iter;
>>
>> ListStore store = new ListStore (typeof (string));
>> CellRendererText cell = new CellRendererText ();
>>            
>> ComboBox combo = new ComboBox();
>> combo.PackStart (cell, false);
>> combo.AddAttribute (cell, "text", 0);
>> combo.Model = store;
>>            
>> iter = store.AppendValues ("BLA"); // populate combo
>> </snippet>
>>
>> --ppires
>>
>> Jorge Cabello wrote:
>>     
>>> Hello,
>>>
>>> Im having a problem with ComboBoxEntry Class:
>>> I have a ComboBoxEntry created with LibGlade. Im trying to set a Model
>>> and the TextColumn from which it has to get the string to show. Heres
>>> the code:
>>>
>>>     ListStore store = new ListStore (typeof(int), typeof(string));
>>>     store.AppendValues (1, "Test"); 
>>>     Combo1.Model = store;
>>>     Combo1.TextColumn = 1;
>>>
>>> Combo1 is declared as: [Widget] Gtk.ComboBoxEntry Combo1;
>>>
>>> When I run this code I get the following error:
>>> Gtk:proc 18803(critical): gtk_combo_box_entry_set_text_column: assertion
>>> `entry_box->priv->text_column == -1' failed
>>>
>>> Can anyone help me?
>>>
>>> I have tested to create the ComboBoxEntry without using the TextColumn
>>> attribute and it runs fine.
>>>
>>>
>>> _______________________________________________
>>> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>>>
>>>   
>>>       
>>
>>     
>
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
>   



More information about the Gtk-sharp-list mailing list