Gtk.Table Class
Pack widgets in grid/table patterns.

See Also: Table Members

Syntax

[System.Reflection.DefaultMember("Item")]
public class Table : Container

Remarks

The Table widget allows a programmer to arrange widgets in rows and columns, making it easy to align many widgets adjacent to each other, horizontally and vertically.

Tables are created with a specific size - the number of rows and columns. This can be changed dynamically with the Table.Resize method. Widgets are packed into the table with Table.Attach methods.

The layout of a table can be altered by setting the spacing between rows and columns. This is done with the Table.ColumnSpacing and Table.RowSpacing properties, respectively. The spacing of individual cells can be adjusted with Table.SetColSpacing and Table.SetRowSpacing.

The following shows how to create a table with three widgets:

C# Example

public Widget MakeTableTester()
{
	// Create a table with 2 rows and 1 column
	Table tableLayout = new Table(2, 1, false);
	Label longLabel = new Label("This is a label that spans at least two Entry widgets");
	
	// Attach the label over the entire first row
	tableLayout.Attach(longLabel,   0, 2, 0, 1);
	// Attach an entry to each cell in the second row
	tableLayout.Attach(new Entry(), 0, 1, 1, 2);
	tableLayout.Attach(new Entry(), 1, 2, 1, 2);
	
	tableLayout.ShowAll();
	return tableLayout;
}
    

Requirements

Namespace: Gtk
Assembly: gtk-sharp (in gtk-sharp.dll)
Assembly Versions: 2.12.0.0