Re: Refresh the label-text???
| From: | Steph | Date: | Sun, 18 Nov 2001 15:42:40 +0000 |
| Subject: | Re: Refresh the label-text??? | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-618@lists.php.net to get a copy of this message | ||
One day I'm going to learn to read to the end of the mail :)
You need to pass the $label as a parameter, not globalise it.
eg
function get_input($entry, $label) {
..
}
- then it works.
----- Original Message -----
From: "Steph" <Steph.Fox@btinternet.com>
To: "Hendrik Daldrup" <Hendrik.Daldrup@t-online.de>;
<php-gtk-general@lists.php.net>
Sent: Sunday, November 18, 2001 3:28 PM
Subject: Re: [PHP-GTK] Refresh the label-text???
um, you don't put quotes around a variable, for a start ..
It's a bit hard to say without seeing the script. Is it short, can you send it to the list?
----- Original Message -----
From: "Hendrik Daldrup" <Hendrik.Daldrup@t-online.de>
To: <php-gtk-general@lists.php.net>
Sent: Sunday, November 18, 2001 3:30 PM
Subject: [PHP-GTK] Refresh the label-text???
> 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();
>
> ?>
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, e-mail: php-gtk-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-gtk-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, e-mail: php-gtk-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-gtk-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net