Manipulating a simple list




hi...am new to gtk+ and am trying to build an application..i managed to
display some text in a list but now i want to add a button(delete) which
will delete a selected row from the list..am working in C..please help me.

here is the code for my list:

void    //add item to list list_modify
on_bt_add_clicked                      (GtkButton       *button,
                                        gpointer         user_data)
{
        
        GtkWidget *listitem;

        gchar str[50];
        gchar *p_str = str;

        GtkWidget *entry = lookup_widget(GTK_WIDGET(button), "txt_mybox"); //
Getting pointers to
        GtkWidget *list = lookup_widget(GTK_WIDGET(button), "list_modify"); //
txt_mybox & list_modify
        
        strncpy(p_str, gtk_entry_get_text(GTK_ENTRY(entry)),50);        // Storing the
text of txt_mybox (entry) in the variable p_str

        
        listitem = gtk_list_item_new_with_label (p_str); // Adding p_str to the
list
        gtk_container_add (GTK_CONTAINER (list), listitem);


        gtk_widget_show(listitem); // Showing the updated list
}


now i want to delete a row by clicking on button delete...please help me

thanks
-- 
View this message in context: http://www.nabble.com/Manipulating-a-simple-list-tf3357792.html#a9339389
Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com.




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