Re: deleting entry from a combo box



Here is the piece of code which deletes the item in the combo box. Everything works fine - until i call 
gtk_combo_set_popdown_strings() - it gives a secgmentation fault.
And without calling the gtk_combo_set_popdown_strings() the list in the combo box doesnt get updated.

Should i do anything else other than this?


        GList *lItems = NULL;
        GList *item = NULL ;
        GtkWidget *cmbAddedApps = gtk_object_get_data( GTK_OBJECT( wndmain), "cmbAddedApps");

        lItems = GTK_COMBO(cmbAddedApps)->list ; // REFERENCE THE LIST IN THE COMBO BOX
        item = GTK_LIST(lItems)->selection ;     // REFERENCE THE SELECTED ITEM IN THE LIST

        item = g_list_append(NULL,item->data) ;
        gtk_list_unselect_all(GTK_LIST(lItems)) ;
        gtk_list_remove_items(GTK_LIST(lItems),item) ;

        gtk_combo_set_popdown_strings( GTK_COMBO(cmbAddedApps), GTK_LIST(lItems));
_____________
parthasarathi s a
e-mail: parthasarathi at odysseytec dot com
___________________ 
Live to Win. Dare to Lose.
___________________


On Wed, 17 Sep 2003 07:14:00 -0700 (PDT)
Harring Figueiredo <harringf yahoo com> wrote:



 Keep a reference to your GList, and search the string you want to delete.
After you modify the list, call gtk_combo_set_popdown_strings() again.

Harring.

--- parthasarathi s a <parthasarathi mail cyberneme com> wrote:
hi all,
I have a combo box which i have filled using the function
gtk_combo_set_popdown_strings() - passing a populated GList to the function.
Now i have to delete an entry in the combo box - how do i get access to the
clist now. and how do i delete .

here is the code snippet of how am adding a list to the combo box..

/*wndmain is a pointer to the main window which houses the combo box
"cmdAddedApps" */
    GList *lItems = NULL;
        GtkWidget *cmbAddedApps = gtk_object_get_data( GTK_OBJECT( wndmain),
"cmbAddedApps");


    for(i=0;i<stGuiConf.app_count;i++)
        {
      
                lItems = g_list_append( lItems,
stGuiConf.app[i].app_id.f_name);
      
        }
        if (lItems != NULL)
                gtk_combo_set_popdown_strings( GTK_COMBO( cmbAddedApps),
lItems);

 
Any suggestions???
Thank you
-partha

_____________
parthasarathi s a
e-mail: parthasarathi at odysseytec dot com
___________________ 
Live to Win. Dare to Lose.
___________________
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com






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