Re: another class question/problem
| From: | Rich Payne | Date: | Mon, 05 Mar 2001 22:21:03 +0000 |
| Subject: | Re: another class question/problem | ||
| References: | 1 | Groups: | php.gtk |
| Request: | Send a blank email to php-gtk+get-344@lists.php.net to get a copy of this message | ||
That was it! Though I'd tried that but I guess not.
much thanks,
--rdp
On Mon, 5 Mar 2001, Frank M. Kromann wrote:
> I think it is your use of variables in the class.
>
> Try this code:
>
> class Add_Window extends GtkWindow {
> var $add_button;
>
> function Add_Window() {
> $this->add_button = &new GtkButton("Add To DB");
> }
> function get_add_button() {
> return $this->add_button;
> }
> }
>
>
> - Frank
> >
> > I've run into another problem, and can't figure out what I'm doing
> > wrong. I've created a class that extends GtkWindow, code looks like this
> > (some of the GUI code has been removed for simplicity):
> >
> > class Add_Window extends GtkWindow {
> > var $add_button;
> >
> > function Add_Window() {
> > $add_button = &new GtkButton("Add To DB");
> > }
> > function get_add_button() {
> > global $add_button;
> > return $add_button;
> > }
> > }
> >
> > Now, from another php file I create an instance of this class, then try to
> > register and event handler for the button, something like:
> >
> > $add_sys_window = &new Add_Window();
> > $add_sys_window_add_button=$add_sys_window->get_add_button();
> > $add_sys_window_add_button->connect('clicked',add_to_db);
> >
> > however, what happens is that I get one event when the window is created,
> > and nothing else...I can click on that button all day and no events seem
> > to get deliverd to the calling code.
> >
> > Any ideas? I'm pretty sure I used to do similar things in Java a while
> > back w/o any trouble.
> >
> > TIA,
> > --rdp
> >
> > --
> > Rich Payne
> > rpayne@alphalinux.org www.alphalinux.org
> >
> >
> > --
> > PHP GTK Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-gtk-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-gtk-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
> >
>
>
>
>
>
--
Rich Payne
rpayne@alphalinux.org www.alphalinux.org