deriving Objects out of GtkWidgets
| From: | Suraj.co.in | Date: | Tue, 08 Jan 2002 13:03:38 +0000 |
| Subject: | deriving Objects out of GtkWidgets | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-973@lists.php.net to get a copy of this message | ||
Hi All,
I was trying to write a few classes that I thought will come in handy,
such as the ones similar to the gnome-widgets (found in glade-gnome).
This is a sample code:
class FileEntry extends GtkHBox {
var $txtbox;
var $but;
function someclass () {
parent::GtkHBox();
$this->txtbox=new GtkEntry(); //see 1
$this->but=new GtkButton ("Browse"); //see 1
$this->txtbox->set_editable (true); //see 2
...
$this->but->connect_object ("clicked", array ("fileentry",
"but_clicked")); // see 2
}
function but_clicked() {
echo "you clicked me!\n";
}
}
I had the following problems with the above code:
1. References to Objects (in this case GtkEntry and
GtkButton) weren't allowed
2. I get a " Class 'gtkfiletext' does not support overloaded method
calls" error. Why?
Thanks in Advance,
-Suraj
--
+----------------------------------------------<suraj@chennailug.org>--+
| Courage is companion in aid, to the one who |
| acts firm, from a chosen field, with brain |
| (judging place - 7), Thirukkural |
+--<http://chennailug.org/~suraj/>-------------------------------------+