Snippet. Vala. Create a Border Layout with GTK

A border layout lays out a container, arranging and resizing its components to fit in five regions: north, south, east, west, and center.

Gtk.Label label_north = new Gtk.Label("NORTH");
Gtk.Label label_center = new Gtk.Label("CENTER");
Gtk.Label label_south = new Gtk.Label("SOUTH");
Gtk.Label label_east = new Gtk.Label("EAST");
Gtk.Label label_west = new Gtk.Label("WEST");

Gtk.VBox vbox = new Gtk.VBox(true,5);
Gtk.HBox hbox = new Gtk.HBox(true,5);

hbox.add(label_west);
hbox.add(label_center);
hbox.add(label_east);
vbox.add(label_north);
vbox.add(hbox);
vbox.add(label_south);

Result

Vala - Gtk - Border Layout

Updated on: 03 Dec 2024