Re: GtkLayout continued - anyone out there?
| From: | Steph | Date: | Fri, 01 Mar 2002 00:31:15 +0000 |
| Subject: | Re: GtkLayout continued - anyone out there? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1396@lists.php.net to get a copy of this message | ||
Cool, thank you.
Following discussion with Havoc (GTK dev team), we're all agreed it's a bug in the win32
port of GTK (nothing to do with our Frank).
Under win32, we need to connect to the scrolled window's adjustment changes and use
$layout->queue_draw() to see any apparent scrolling at all in the layout widget.
In the second example, the labels scroll as expected but the buttons are stationary. I have
absolutely no idea why, and can't get them to budge except by doing the maximize/restore thing
to create an expose event. The first example works only if you make the GtkButtons into GtkLabels
and use the queue_draw() callback.
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();
?>
----- Original Message -----
From: "Jared Smith" <jaredsmith@jaredsmith.net>
To: "Steph" <steph.fox@btinternet.com>
Cc: "PHP-GTK gen" <php-gtk-general@lists.php.net>
Sent: Thursday, February 28, 2002 10:53 PM
Subject: Re: [PHP-GTK] GtkLayout continued - anyone out there?
> OK, I've posted some screenshots of both of Steph's scripts at
> http://www.jaredsmith.net/jared/shots.html... It should give
> you an idea
> of what's going on. (For some reason, my screenshots didn't get the
> border around the window... I guess I'll have to reread the man page on
> "import" again.)
>
> Jared
>
> >
>
>