How to purge an Gtk Table from all it's widgets
I am a newbie to gtk and c.
Using c and libglade for my program.
I am writing a program that needs to update a gtk table over and over depending on the combobox selection that was made by the user.
With initialization the gui has a vbox with an empty table in it. The user select an option开发者_C百科 from the combobox and depending on the selection the table is packed with widgets (labels and entryboxes). Should the user change his selection to a different option I need to clear the table of the previous widgets and pack the table with new appropriate widget for the selection.
I have tried to destroy the table widget and re-create a new table to add to the vbox but then I receive a Segmentation fault.
Is there a way of destroying the widgets in the table but not the table or a different way of doing what I want to do?
Sounds like you need to use a GtkTreeView
with a GtkListStore
instead of a table, and GtkCellRendererText
instead of labels and entry boxes. The table isn't designed for displaying dynamic data.
Have you tried tblFoo.resize(0, 0)
?
You can delete the existing table and create + add a new table where the old one was attached, e.g. inside a vertical box.
精彩评论