Sorry, AddExec Again

Sorry I have to ask the question again. I generate the dictionary but still doesn’t work.
The question is why DoSomething() works in:
[size=100]
button->Connect(“Clicked()”,“button”,this,“DoSomething()”);
[/size]
but not in
[size=100]
gPad->AddExec(“Aname”,“DoSomething()”); ??
[/size]

Many Thanks.

#################################################################
[color=indigo]
Thank you very much for you kind reply.
I copy some lines from the Makefile of ROOT/test directory and solve the problem.
Thank you.
[/color]

[color=darkblue]
It is likely that you forget to generate a dictionary for your code.
When you call AddExec your function PeakPoint must be accessible from
the interpreter.
If you do not understand what I am talking about, send the shortest possible ,but running piece of code, we will add the relevant bits to create a dictionary.
or, if you are in a rush, look at the Users Guide.

Rene[/color]

Please send a short piece of running code that I can execute to understand your problem.

Rene

Thans, Rene, Here are the files, I want to know the position of the mouse in the Canvas which display a 2D picture.

in the line 40 I want to use :[color=green] gPad->AddExec(“peakpoint”,“PeakPoint()”); [/color]to capture the click point of mouse on the 2D picture.

I use “make TraceViewer” to build the program for run.

Thanks.
TraceViewer.h (3.98 KB)
TraceViewer.cxx (11 KB)
Makefile.txt (11.8 KB)

2 files more to compile.
Makefile.arch.txt (12.8 KB)
TraceViewerLinkDef.h (148 Bytes)

You forgot tos end a test program for your class.
Anyhow, you should change

-in TracViewer.h
void PeakPoint();
to
static void PeakPoint();

-in TracViewer.cxx
gPad->AddExec(“peakpoint”,“PeakPoint()”);
to
gPad->AddExec(“peakpoint”,“Trace::PeakPoint()”);

Rene

[size=134]Many thanks, Your answer works fine.[/size]