How to: grid of panes

I am new to GTK and would like to know what layout containers would I have to use in order to create a grid of panes. My initial idea was to use GtkPaned until I realized that it can only have 2 panes.

I am trying to create an interface similar to that of the acme editor shown at

Any help would be greatly appreciated.

I did that in my NEd Nim editor, and I think gedit does it also: Start with one GtkSourceView widget, and split that one vertically or horizontally into a GtkPaned, each containing a new GtkSourceView. Repeat as long as you like.

Ah ok :slight_smile: Did not realize I could keep doing +1 on the pane. Will try it out.
Thanks a lot Stefan

If it is not obvious how to do it, then you may have a look in my NEd code at It was really easy, collapsing a GtkPaned with two GtkSourceView into one single GtkSourceView too. But I thing I have never managed to store the actual state, so one has always to start with a single GtkSourceView, which is then replaced with a GtkPaned containing a GtkSourceView in each Pane and so on. Note that NEd will not compile with latest Nim Compiler, I have not touched its code for some years…

Got it working. Thanks a lot Stefan

Stefan, is it possible to drag the panes around? I am not talking about the separator but the pane itself.

Yes, from documentation:

The Gears menu on the top right of the main window has entries for splitting the current view vertically or horizontally — you can change the size of the split views with an invisible slider. And you can reposition notebook tabs by grabbing the tab with the textual label and moving it onto other tabs (drag and drop). (That does not work when tabs are hidden, and needs some skills: Mouse pointer changes shape when drop position is reached.) Generally new views are opened in the notebook[2] which contains the last active view — the one which had focus (input cursor ) recently. If the active view has title Unsaved and contains no text, that one is used for the new file. (Remember, it has to be active, so you may have to click into that text area before to indicate that you really want to fill that one.) If you try to open an already opened file again, you will get a new view of that file using the already existing test buffer. Generally you use a different notebook for that so that both views are visible at the same time and you can edit the buffer at different locations.

Was working not bad, but I can not remember details. I would assume gedit has similar functionality, but I am using most of the time only one single GtkSourceView widget in NEd and gedit.

Ok, so in order to allow drag and drop of the pane, the GtkSourceView needs to be wrapped inside a GtkNotebook? Did I get that right?

I don’t think we need a GtkNoteBook, but we need something that we can grab. A plain Text area may not work.

It is more than 3 years ago when I wrote that code, so I can not remember well. And the drag and drop was more a bonus, was not intended from the beginning, I just tried and was surprised that it worked. Using GtkNoteBooks was intended, I thought that it would be nice to have Notebook tabs.

Maybe you should open a new Thread asking about Drag&Drop, people like ebassi know much more about this topic.