Kritzefitz
Kritzefitz

Reputation: 2754

Tables in glade

I'm making a GUI application with gtk2hs. Most of the GUI is designed in Glade. I now need a table to show some data. The problem is, that I can't find the table in glade. I searched in the Container category, but only found a "Grid". However I couldn't find a Grid in the documentation of gtk2hs, but I need the castTo* function for the grid to use it.

I'm now wondering where the Table in glade is or how I can use the grid in gtk2hs.

My glade version: 3.18.2
My gtk2hs version: 0.12.5.7

Upvotes: 0

Views: 4695

Answers (1)

Alfonso Villén
Alfonso Villén

Reputation: 373

In GTK, tables are a way of arranging widgets on a window. There are also boxes, notebooks etc. They can't be used to display data.

For showing data, you need a TreeView and a TreeModel.

You store your data in a TreeModel, typically a ListStore or a TreeStore, and use a TreeView to show the data as rows with columns (from a ListStore) or as a tree (TreeStore).

If you modify the data in the TreeModel, the TreeView updates itself accordingly.

Moreover:

  • Several TreeViews can share a TreeModel, and they can display different data columns, or the same data columns in different formats.
  • TreeViews can filter data rows automatically (using TreeModelFilter).
  • They can also sort data rows automatically (using TreeModelSort).
  • And they support drag & drop.

Finally, through the TreeView you can react to user interaction (mouse clicks, cell and/or node edition etc.).

Upvotes: 4

Related Questions