01 May 2013 - After the site upgrade, all passwords were reset and you will need to ask the site for a login reset on your first connection.
Like layout tables in HTML pages,
the GtkTable widget can be used to display
tables or matrix, far more easily
than GtkTreeView and associated classes.
This example shows how to use a layout table and fill it with
numerous instances of GtkLabel, of varying
colours.
<?php
define('SIZE_X', 10);
define('SIZE_Y', 3);
# WIDGET HIERARCHY
$window = new GtkWindow();
/**
* Creating our GtkTable
* note that the homogeneous property defaults to false.
*/
$table = new GtkTable(SIZE_X, SIZE_Y, false);
# labels
for ($i = 0 ; $i < SIZE_X ; $i++) {
for ($j = 0 ; $j < SIZE_Y ; $j++) {
$label = new GtkLabel("$i : $j");
$table->attach($label, $i, $i+1, $j, $j+1,
Gtk::EXPAND, Gtk::EXPAND);
}
}
/**
* SETTINGS
*/
// Title of the window
$window->set_title("GtkTable usage demonstration");
// Initial placement of the window
$window->set_position(Gtk::WIN_POS_CENTER);
// Connecting the "destroy" signal
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
// Let's define the spacing between columns and rows to 10 pixels
$table->set_row_spacings(10);
$table->set_col_spacings(10);
/**
* ASSEMBLY
*/
// Adding the table to the window
$window->add($table);
$count = 0;
foreach ($table->get_children() as $child) {
$count++;
# set a random color
if ($count %2 == 0)
$color = 'red';
else
$color = 'green';
$child->modify_fg(Gtk::STATE_NORMAL,
$label->get_colormap()->alloc_color($color));
}
// Make everything in the window visible
$window->show_all();
//Main loop
Gtk::main();
?>| Anhang | Größe |
|---|---|
| gtktable.gif | 6.34 KB |
Neueste Kommentare
vor 43 Wochen 5 Tage
vor 44 Wochen 5 Tage
vor 45 Wochen 1 Tag
vor 47 Wochen 5 Tage
vor 1 Jahr 16 Wochen
vor 1 Jahr 19 Wochen
vor 1 Jahr 23 Wochen
vor 1 Jahr 23 Wochen
vor 1 Jahr 23 Wochen
vor 1 Jahr 40 Wochen