Re: removing rows from a table



Sander Marechal wrote:

> Hello all,
>
> I'm creating a game and I am using a GtkTable to display a table with scores in them. After every round I add a new row to the table and display a new series of values in the cells (using GtkLabels).
>
> When a player starts a new game, I need to reset this table (remove all rows except the "header" row). I tried it this way:
>
>
> GtkTable table;
> score_table = (GtkTable*)glade_xml_get_widget(xml, "score_table");
> gtk_table_resize(score_table, 1, 4); // shrink to destroy the scores
>
>
> But that doesn't make the table smaller apparently. When I show the scores, I still see all the rows. So, how can I remove the rows from the GtkTable?
>
> Thanks in advance :-)
>

I solved it. For future reference: gtk_table_resize() only makes the tble smaller if there are no child widgets in the rows/columns you want to remove. I tried iterating over table->children to find all those widgets, but I could not get that working. I ended up keeping a GList of the widgets that I add to the table and iterate over that list to remove widgets prior to the resize. That works.

--
Sander



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