gtk3vala

How to dynamically insert and remove rows


I'm looking for a widget which can be dynamically resized. I need to append and remove rows. There are a methods coming with Grid, like gtk_grid_insert_row or gtk_grid_insert_next_to, but I don't find any xxx_remove_xxx method.

I'm developing a simple http client (to test an api). And I'm adding the possibility to append and remove "GET" variables dynamically.

The UI is made with rows containing a combobox (for variable selection), an entry (for its value) and on the last row a remove button.

Every time I set a variable, a new line (new available variable) is appended. And every time I unset a variable, the corresponding line is removed.

enter image description here

thanks.


Solution

  • Being this old, maybe you are looking for GTK method "Grid remove_row" ?

    gtk_grid_remove_row(GtkGrid* grid, int position);

    I use a GtkGrid as dynamic selection list and that's how I remove a row. Hope it helps.