Re: [Re: how to get text from combo box]





Ooops, sory... bad habits with html mails
I reply in plain text...

>hi,
>
>i tried ..... but don't know why it is not working.
>
>this is a gist of my program
>
>GtkWidget *combo;
>GList *list=NULL;
>
>//list-- has a list of items
>
>gtk_signal_connect(GTK_OBJECT(GTK_COMBO(combo)->list),"select-child",
> GTK_SIGNAL_FUNC(my_callback),NULL);
>
>//my_callback function is like this
>
>void my_callback(GtkWidget *combo)
>{
> char *string;
>string=gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(combo)->entry),0,-1);
>g_print("%s\n",string);
>free(string);
>}
>
>its also giving me warning such as
>
>warning : invalid cast from GtkList to GtkCombo
>and many more such warnings

Hi,

Your warning appears because you give a GtkList to your callback (the "list" member of a GtkCombo is a widget GtkList...)
So your callback must be like this :

void my_callback(GtkList *list, GtkWidget *element, gpointer my_data)
{
...
}

where element is the newly selected child.

regards, JFB





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