Problem with GTK entry get_text function
| From: | Jim Clark | Date: | Tue, 29 Mar 2005 20:22:51 +0000 |
| Subject: | Problem with GTK entry get_text function | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-5700@lists.php.net to get a copy of this message | ||
Hi,
I am having trouble accessing variables generated
using 'while loop' for GTK Entry. I have pasted the
code below which obviously doesnt work.I would be
really thankful if anyone can help me OR suggest an
alternative.
<?php
if( !extension_loaded('gtk'))
{
dl( 'php_gtk.' . PHP_SHLIB_SUFFIX);
}
$display = &new GtkWindow();
$display->set_title('Uinque');
$display->set_usize(640,480);
$box = &new GtkVbox();
$display->add($box);
class abc
{
function main()
{
global $box;
$x = 1;
while ($x < 5)
{
global ${'merc'.$x};
$GLOBALS[${'merc'.$x}] = &new GtkEntry();
$box->pack_start($GLOBALS[${'merc'.$x}]);
$GLOBALS[${'merc'.$x}]->set_text('merc'.$x);
$GLOBALS[${'merc'.$x}]->show();
$x++;
}
}
function get_text()
{
global $merc1;
$gettext = $merc1->get_text();
echo $gettext;
}
}
$abc = new abc;
$abc->main();
function gt()
{
global $abc;
$abc->get_text();
}
$btn = &new GtkButton('Retrieve') ;
$btn->show();
$btn->connect('clicked','gt');
$box->pack_end($btn);
$display->show_all();
Gtk::Main();
?>
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/