Re: GtkLayout continued - anyone out there?
| From: | Nikolajus Krauklis | Date: | Fri, 01 Mar 2002 08:17:32 +0000 |
| Subject: | Re: GtkLayout continued - anyone out there? | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1401@lists.php.net to get a copy of this message | ||
> New adaptation below, on the off-chance that any Windows people feel like
solving The Great Button Mystery :)
>
> <?
> dl("php_gtk." . (strstr(PHP_OS, "WIN") ? "dll" :
> "so"));
>
> function exposure($adj, $layout) {
> $layout->queue_draw();
> }
>
> $window = &new GtkWindow();
> $window->set_position(GTK_WIN_POS_CENTER);
> $window->set_title('Layout');
> $window->set_usize(200, 200);
> $window->connect_object("destroy", array("gtk", "main_quit"));
>
> $scrolledwindow = &new GtkScrolledWindow();
> $window->add($scrolledwindow);
>
> $layout = &new GtkLayout(null, null);
> $scrolledwindow->add($layout);
>
> $x = gdk::screen_width();
> $y = gdk::screen_height();
> $layout->set_size($x, $y);
>
> $hadj = $scrolledwindow->get_hadjustment();
> $vadj = $scrolledwindow->get_vadjustment();
> $hadj->connect('value-changed', 'exposure', $layout);
> $vadj->connect('value-changed', 'exposure', $layout);
>
> for ($i=0 ; $i < round($y/100); $i++) {
> for ($j=0 ; $j < round($x/100); $j++) {
> $buf =sprintf("Button %d, %d", $i, $j);
> if (($i + $j) % 2) $button = &new GtkButton($buf);
> else $button = &new GtkLabel($buf);
> $layout->put($button, $j*100, $i*100);
> }
> }
>
> $layout->show_all();
> $window->show_all();
>
> gtk::main();
> ?>
>
Hi everyone,
this example works strange in win2k :) Labels moving but all buttons are
stable.
Funny :)
Nikolajus Krauklis