A way to get simple table NxM (gtk4)

Hi everyone,

What’s the best way in GTK4 to get a simple table NxM with separators between rows?
Numbers are not big (a couple dozen of rows and columns). Cells’ content changes dynamically and very often.I suppose it can be ColumnView, but not sure.

Hi,

Probably a GtkGrid would do the job, but a GtkColumnView could be a solution, it depends on how you manage the underlying data.

For the GtkGrid case, you can fill it with GtkLabel, GtkText or GtkInscription, depending on your sizing and editability requirements.
Regarding the separator, in one of my projects I just used a 1pixel row-spacing and set a background color with CSS for the GtkGrid to draw the separator.
You can also insert a GtkSeparator alternately in the GtkGrid.

1 Like

Thanks for the suggestion, maybe in the future I’ll try them all,
for now it’s already settled on listbox with no models and other a bit complicated to me things. Underlying cell’s data is kept in usual NxM array to get fast access and update. There’s no need in editability, sizing is calculated on the fly, only requirement is fast redrawing.

1 Like

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.