gApplication

I am compiling a code with g++, after succesfully creating the corresponding dictionary. I get an error which does not appear while running the same code within the ROOT-interpreter. It is due to this code line:

TGTextButton *prout = new TGTextButton(main_frame,“LABEL”);
prout->Connect(“Pressed()”, “tgupdate”, gApplication, “run_something()”);

“run_something” is defined in the tgupdate class, gApplication is not. In fact the error message is:
error: cannot convert ‘Bool_t’ to ‘int*’ in assignment
which makes sense, but what should I replace ‘gApplication’ with? Somewhere I read a “0” could do, but it does not. I have tried defining a void “myApp” in my class tgupdate, but that does nto help either. Why does the interpreter just do the right thing? What can I do to compile it? It would speed up my code by more than a factor 10.

Thanks
Giovanni

Hi Giovanni,

instead of gApplication, you must pass the pointer to your class. Something like this:

tgupdate *update = new tgupdate(...); prout->Connect("Pressed()", "tgupdate", update, "run_something()");
See also this HowTo, the “Event Processing: Signals and Slots” chapter in the User’s Guide, and the many examples in ROOTSYS/tutorials/gui

Cheers, Bertrand

Dear Bertrand,
thank you, the problem was trivial:
In

val=t_txt->Connect(“TextChanged(char*)”, 0, 0, “PrintOut(char*)”);

“val” was defined
int *val;

Things work defining
int val;