Package: gtk
Class gtk:grid
Superclassesgtk:widget, gobject:initially-unowned, gtk:accessible, gtk:buildable, gtk:constraint-target, gtk:orientable, gobject:object, common-lisp:standard-object, common-lisp:t Documented Subclasses
None
Direct SlotsDetails The gtk:grid widget is a container which arranges its child widgets
in rows and columns, with arbitrary positions and horizontal/vertical spans. ![]() Children are added using the gtk:grid-attach function. They can span multiple rows or columns. It is also possible to add a child widget next to an existing child widget, using the gtk:grid-attach-next-to function. To remove a child widget from the grid, use the gtk:grid-remove function. The behaviour of the gtk:grid widget when several children occupy the same grid cell is undefined. GtkGrid as GtkBuildableIt is implemented by the gtk:widget class using the gtk:layout-manager class. To showcase it, here is a simple example: <object class="GtkGrid" id="my_grid"> <child> <object class="GtkButton" id="button1"> <property name="label">Button 1</property> <layout> <property name="column">0</property> <property name="row">0</property> </layout> </object> </child> <child> <object class="GtkButton" id="button2"> <property name="label">Button 2</property> <layout> <property name="column">1</property> <property name="row">0</property> </layout> </object> </child> <child> <object class="GtkButton" id="button3"> <property name="label">Button 3</property> <layout> <property name="column">2</property> <property name="row">0</property> <property name="row-span">2</property> </layout> </object> </child> <child> <object class="GtkButton" id="button4"> <property name="label">Button 4</property> <layout> <property name="column">0</property> <property name="row">1</property> <property name="column-span">2</property> </layout> </object> </child> </object>It organizes the first two buttons side-by-side in one cell each. The third button is in the last column but spans across two rows. This is defined by the row-span property. The last button is located in the second row and spans across two columns, which is defined by the column-span property. CSS nodesAccessibility | Returned bySlot Access Functions
Inherited Slot Access FunctionsSee also |
2025-05-10