Refresh the label-text???
| From: | (Hendrik Daldrup) | Date: | Sun, 18 Nov 2001 15:30:15 +0000 |
| Subject: | Refresh the label-text??? | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-616@lists.php.net to get a copy of this message | ||
hi there,
i know this one is a dumb question, but i really dont know, why it doesnt work!
I just wanted to get a line from a text-entry and get it displayed as a label.
If the user enters a new line, the label will display the new text!
...so i made this script, but it wont work...
why cant i simply say
$label->set_text("$input");
to update the label???
thx,
so long,
Hendrik
<?php
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
dl('php_gtk.dll');
else
dl('php_gtk.so');
function closeWindow($widget) {
$window = $widget->get_toplevel();
$window->destroy();
unset($window);
}
function get_input($label) {
global $entry;
$input=$entry->get_text();
print "$input\n";
$label->set_text("$input");
$entry->grab_focus();
$entry->set_text("");
}
$window = &new GtkWindow();
$window->set_position(GTK_WIN_POS_MOUSE);
$window->connect_object("destroy", array("gtk", "main_quit"));
$vpaned = &new GtkVPaned();
$window->add($vpaned);
$vpaned->show();
$label = &new GtkLabel();
$vpaned->pack1($label);
$label->show();
$entry = &new GtkEntry();
$vpaned->pack2($entry);
$entry->connect("activate", "get_input", $label);
$entry->show();
$window->show_all();
gtk::main();
?>