Re: [PHP-GTK] Button How to intercept signal from a istance of classinto another class

[email protected] (Elizabeth M Smith) Wed, 29 Oct 2008 07:32:30 -0400
Newsgroups php.gtk.general
Message-ID <[email protected]>
AngeloP wrote:
> Problem:
> I have a main window class
> 
> class mywin extends GtkWindow
> {
>  ...constructor...
> ...
> 
> // Button section 
> $three_buttons = new mybuttons()
> $vbox -> pack_start($three_buttons,0);   
> ...... ..etc...
> end constructor
> 
> function OneFunction()
> {
>     make something
> }
> 
> }
> 
> class mybuttons extends GtkHbox
> {
> .... constructor
> 
>     $button_a=new GtkButton("Open");
>      $this -> pack_start($button_a,0);   
> 
>     $button_b=new GtkButton("Run");
>      $this -> pack_start($button_b,0);   
> 
>     $button_c=new GtkButton("Close");
>      $this -> pack_start($button_c,0);   
>  
>      $close_c->connect("clicked", array($this,"OnClose")); // note 6 
>       
> ...... end cosntructor
> 
> function OnClose ($widget )
> {
> Here I would call the function OneFunction() in the parent class
> How can I make it ???
> }
> 
> }
> 
> 
> Thanks
> 

This is a basic PHP and object oriented programming question - please
read the manual.

To access any method in a child class (a class that extends another
class) you use parent

so onClose should call parent::OneFunction();

Thanks
Elizabeth