Re: notebook again
| From: | Rich Payne | Date: | Thu, 11 Sep 2003 13:06:36 +0000 |
| Subject: | Re: notebook again | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3874@lists.php.net to get a copy of this message | ||
On Thu, 11 Sep 2003, Christian Machmeier wrote:
> Hy NG!
>
> The problem is that the function call now gets executed every time i
> click a tab and also as often as I have tabs (so four times). I tried to
> use
Sorry, not seeing that here. I see a set of calls when the GUI is built,
but I only see one function call for each page switch on the notebook.
Here's the example code I wrote, does this do multiple calls for you?
<?php
dl ('php_gtk.so');
$window = &new GtkWindow();
$notebook = &new GtkNotebook();
$notebook->set_border_width(5);
$notebook->connect ('switch-page',page_changed);
$button1 = &new GtkButton("Button 1");
$button2 = &new GtkButton("Button 2");
$button3 = &new GtkButton("Button 3");
$label1 = &new GtkLabel("Page 1");
$label2 = &new GtkLabel("Page 2");
$label3 = &new GtkLabel("Page 3");
$notebook->append_page($button1,$label1);
$notebook->append_page($button2,$label2);
$notebook->append_page($button3,$label3);
$window->add($notebook);
$window->set_usize(640,480);
$window->show_all();
$window->connect('destroy','destroy');
Gtk::main();
function destroy()
{
Gtk::main_quit();
}
function page_changed($notebook,$page,$page_num) {
echo "Page Changed. New Page is: $page_num \n";
}
?>
--rdp
Rich Payne
http://talisman.mv.com
rdp at talisman dot mv dot com