Is it possible to refresh a button box having a number of buttons, when a specific action is implemented such as Submit and Delete? On Submit a new button should be added and on Delete (after selecting the button), the button should get destroyed (not hiden). The GUI is designed using Glade in Gtk-2 and codes are in the C language.
I got my answer. In the for loop instead of creating buttons from i=0, I did took a new int variable that holds the total number of buttons present already and now it only creates the new ones.
void Buttons()
{
int i, totalrecord=0;
int prevtotalbutton;
for (i = prevtotalbutton ; i <totalrecord; i++)
{
ButtonfromArray = gtk_button_new_with_label (array);
gtk_box_pack_start(GTK_BOX(VBbox), ButtonfromArray, FALSE, TRUE, 1);
gtk_signal_connect (GTK_OBJECT (ButtonfromArray), "clicked", GTK_SIGNAL_FUNC (ButtonsCreated), VBbox);
gtk_widget_show (ButtonfromArray);
}
prevtotalbutton=totalrecord;
}
Refreshing the button box is a bit more complicated here. This trick did work and without the use of any new functions to do destroy and all.
Most of us face this problem. Wish my answer may help many like me.