Viewing application/x-php
<?php
uses(
'org.gnome.gtk.Window',
'org.gnome.gdk.Event',
'org.gnome.gtk.Label',
'org.gnome.gtk.Button',
'org.gnome.gtk.VBox'
);
class ButtonClick extends Object {
public static function main(array $args) {
$w= new Window();
$w->setTitle('Hello world');
with ($b= $w->add(new VBox())); {
$b->add(new Label("Just wanted to say\r\n'Hello world!'"));
$b->add(new Button('Cl_ick'))->connect(newinstance(Button::Clicked, array(), '{
public function onClicked($source) {
Console::writeLine("Click! ", $source);
}
}'));
$b->add(new Button('Cl_ock'))->connect(newinstance(Button::Clicked, array(), '{
public function onClicked($source) {
Console::writeLine("Clock! ", $source);
}
}'));
}
$w->showAll();
$w->connect(newinstance(Window::DeleteEvent, array(), '{
public function onDelete($source, $event) {
Gtk::main_quit();
}
}'));
Gtk::main();
}
}
?>
|
Download
You can download the file
«ButtonClick.class.php»
by using
this link.
|