GtkTable::attach

GtkTable::attach

void attach( GtkWidget child , int left_attach, int right_attach, int top_attach, int bottom_attach, [ GtkAttachOptions xoptions = GTK_EXPAND|GTK_FILL , [ GtkAttachOptions yoptions = GTK_EXPAND|GTK_FILL , [int xpadding = 0 , [int ypadding = 0 ]]]]);

attach() is the method used to pack child widgets in a GtkTable. Of the nine parameters delineated, five are absolutely needed.

The first parameter refers to the child widget that is to be attached.

The following pair of parameters denote the starting point that the child will be drawn from, at the left hand side, and the end point that the child will be drawn to, to the right. These parameters are given in terms of columns, with the start point being 0.

The pair after this denote the starting point that the child will be drawn from, at the top, and the end point that the child will be drawn to, at the bottom. These parameters are given in terms of rows, with the start point again being 0.

It is possible for a single child widget to span several rows or columns.

As with all container widgets, the container itself takes up no screen space until it contains a child widget or child widgets. If you attach only one child with parameters that should set it in the bottom right corner and set homogeneous to false, the resulting effect will not be that of a table with only one entry in the bottom right corner, but of a container with a single widget in it - regardless of the number of columns and rows specified in the table's constructor. Child settings always take precedence in a non-homogeneous table, and so all table attachments are relative to the other child widgets. This is in line with the behaviour of other multiple-child capable containers where the child widget can have its own packing parameters set.

The behaviour is very different when a regular grid is in position, which happens when the GtkTable has its homogeneous parameter set to true. The table can work out the dimensions of the grid from the the largest child widget's size request, and positions its children accordingly.

The final four optional parameters determine the way in which the child widget will respond to the area available to it (expand, shrink, fill) in each direction, and the padding between the child and its nearest border, in each direction.

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.