GtkCList Constructor

GtkCList Constructor

GtkCList (int columns, Array titles]);

Creates a new GtkCList object with the given number of columns. The optional second parameter is an array of strings which are uses as column titles.

The columns can be resized with the set_column_width function.

<?php
if( !extension_loaded('gtk')) {	
	dl( 'php_gtk.' . PHP_SHLIB_SUFFIX); 
}

$win = &new GtkWindow();
$win->set_default_size(200,300);
$win->connect('destroy', 'destroy');

function destroy() {
	Gtk::main_quit();
}

$arStatistics	= array(
 array( 'Paris', 9.1),
 array( 'Moscow', 9.0),
 array( 'London', 6.8),
 array( 'Rome', 3.8),
 array( 'Berlin', 3.4),
 array( 'Athena', 3.0)
);

$scrolled_win = &new GtkScrolledWindow();
$scrolled_win->set_policy( GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

$list = &new GtkCList( 2, array( "City", "Inhabitants (M)"));

foreach( $arStatistics as $arStat) {
	$list->insert( 0, $arStat);
}

$list->set_column_width( 0, 90);

$scrolled_win->add( $list);
$win->add( $scrolled_win);
$win->show_all();
GTK::main();
?>

The numbering of a position parameter for a column or row starts at 0.

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