Re: [ROOT] calling function from a button

From: Valeri Fine (fine@bnl.gov)
Date: Tue Sep 18 2001 - 03:47:16 MEST


> hi all experts,
>
> how can I call a function INSIDE my vc++ project from
> a button ? If i put the function name inside the
> ADDBUTTON method obviuously cint is called which of
> course cant find the function !

 From your code you always can call

    gROOT-> ProcessLine(const char *line);
    gROOT->ProcessLineSync(const char *line);

 There is no difference between  these two entries under single thread
version
of ROOT for  UNIX.
Since you are working under Windows you should distinguish


     gROOT->ProcessLine("{test();}");

and

     gROOT->ProcessLineSync("{test();}");

The point is both ProceessLine methods are to send a text message to
so-called CINT thread of Windows implementation of ROOT.
The first returns immediately just the message been sent successfully out,
The second one is to wait until the message is accepted and processed by
CINT
then returns.

   Hope this helps.  Valeri



>
> What I want is something like this:
>
> void test(){cout << test << endl;};
> TButton* B=new TButton("test","{test();}");
>
> joe



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:00 MET