Re: Adding options to a combo box HALF SOLVED !



On 09/08/00 Diego Zuccato wrote:
> Diego Zuccato wrote:
> > Is it possible to add options (possibly sorting them) to a combo box
> > without having to regenerate the whole list ?
> Seems I like chatting with myself :-)
> 
> I just forgot to create a new GtkListItem...
> So the function I'm now using is like :
> 
> void combo_list_append(GtkCombo combo, const char* string)
> {
>  GtkWidget *li=gtk_list_item_new_with_label(string);
>  gtk_container_add(GTK_CONTAINER(combo->list), li);
>  gtk_widget_show(li);
> }
> 
> In the subject I say it's only HALF SOLVED because I can only add to the
> end of the popup list. GtkContainer AFAIK have no method to insert an
> element in a given position :-(

Just use: 
gtk_list_insert_items(GTK_LIST(combo->list), 
	g_list_append(NULL, li), position);

Have a look at gtk/gtklist.h or at the reference documentation for the 
interface of GtkList.

lupus

-- 
Paolo Molaro, Open Source Developer, Linuxcare, Inc.
+39.049.8043411 tel, +39.049.8043412 fax
lupus linuxcare com, http://www.linuxcare.com/
Linuxcare. Support for the revolution.




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