calling functions from a TControlBar button.

From: Frederic FAURE (faure@labs.polycnrs-gre.fr)
Date: Fri Oct 16 1998 - 09:33:53 MEST


Hello, 
>From a TControlBar button, i don't succeed to call class member functions i
wrote,
 except for already defined root function.
(I use ROOT with XLC compilation on AIX, IBM.)

This is an example:

//-----------------------------------
class Fenetre: public TCanvas
{
public:
   Fenetre::Fenetre(Text_t* name, Text_t* title, Int_t ww, Int_t wh) :
TCanvas(name,title,ww,wh)  // constructeur
  {}
   
  void Fenetre::Affiche(int a)
     {cout<<"a="<<a<<endl; }
 
};
 //-------------------------
 void fonction(int a)
 {   cout<<a<<endl;}
 //------------------------------------
 int main(int argc, char **argv)
 { 
  Fenetre *c = new Fenetre("c", "Essai de fenetre", 400,400); 

  TControlBar bar("vertical");
  bar.AddButton("buyton1","fonction(2)","essai");
  bar.AddButton("button2","c->Affiche(3)","essai");
  bar.Show();
  gROOT->SaveContext();
 }
 //----------------------------



 the error with button 1 is:
Error: No symbol fonction(2) in current scope  FILE:/tmp/caaZ0tcyc LINE:1
*** Interpreter error recovered ***

the error with button 2 is:
 Error: Can't call TCanvas::Affiche() in current scope FILE:/tmp/baaXPtcyb
LINE:1
*** Interpreter error recovered ***


I anderstand that the problem is that the global variable: fonction(int) 
and the class member Fenetre::Affiche() must be known from the system,
 but how to do that?

Thank you,
Frederic.

-- 
Frederic Faure
LPMMC (Maison des Magisteres Jean Perrin, CNRS)
BP 166 38042 Grenoble Cedex 9 France
email: faure@labs.polycnrs-gre.fr
tel: 04 76 88 74 98
fax: 04 76 88 79 81



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:38 MET