Table


Object Hierarchy:

Gtk.Table Gtk.Table Gtk.Table Gtk.Container Gtk.Container Gtk.Container->Gtk.Table Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Container GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Atk.Implementor Atk.Implementor Atk.Implementor->Gtk.Table Atk.Implementor->Gtk.Container Atk.Implementor->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.Table Gtk.Buildable->Gtk.Container Gtk.Buildable->Gtk.Widget

Description:

[ CCode ( type_id = "gtk_table_get_type ()" ) ]
[ Version ( deprecated = true , deprecated_since = "3.4" , replacement = "Grid" ) ]
public class Table : Container, Implementor, Buildable

Warning: Table is deprecated since 3.4. Use Grid.

The Table functions allow the programmer to arrange widgets in rows and columns, making it easy to align many widgets next to each other, horizontally and vertically.

Tables are created with a call to Table, the size of which can later be changed with resize.

Widgets can be added to a table using attach or the more convenient (but slightly less flexible) attach_defaults.

To alter the space next to a specific row, use set_row_spacing, and for a column, set_col_spacing. The gaps between all rows or columns can be changed by calling set_row_spacings or set_col_spacings respectively. Note that spacing is added between the children, while padding added by attach is added on either side of the widget it belongs to.

set_homogeneous, can be used to set whether all cells in the table will resize themselves to the size of the largest widget in the table.

Note:

Table has been deprecated. Use Grid instead. It provides the same capabilities as GtkTable for arranging widgets in a rectangular grid, but does support height-for-width geometry management.

Example: Table:

public class Application : Gtk.Window {
public Application () {
// Prepare Gtk.Window:
this.title = "My Gtk.Table";
this.window_position = Gtk.WindowPosition.CENTER;
this.destroy.connect (Gtk.main_quit);
this.set_default_size (350, 70);

// The Table:
Gtk.AttachOptions flags = Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL;
Gtk.Table table = new Gtk.Table (3, 3, true);
table.attach(new Gtk.Label ("1"), 0, 1, 0, 1, flags, flags, 0, 0);
table.attach(new Gtk.Label ("2"), 1, 3, 0, 1, flags, flags, 0, 0);
table.attach(new Gtk.Label ("3"), 0, 1, 1, 3, flags, flags, 0, 0);
table.attach(new Gtk.Label ("4"), 1, 3, 1, 3, flags, flags, 0, 0);
this.add (table);
}

public static int main (string[] args) {
Gtk.init (ref args);

Application app = new Application ();
app.show_all ();
Gtk.main ();
return 0;
}
}

valac --pkg gtk+-3.0 Gtk.Table.vala


Namespace: Gtk
Package: gtk+-3.0

Content:

Properties:

Creation methods:

Methods:

Inherited Members:

All known members inherited from class Gtk.Widget
All known members inherited from interface Atk.Implementor