Connect command problems

Hi All
Firts of All Thanks Valery for your aid about Makefile.
I 'm always testing the example of pages 365-366 “example2a.cxx and example2a.h” of “Users Guide 3.10”.
Now I can compile,but when I execute the program I see his gui, but the “draw” button doesn’t work .
When I execute the program my terminal shows this message:

[gpcalma@EMANUELE test]$ ./example2
Error in <TQObject::CheckConnectArgs>: slot DoDraw() does not exist"

This is a strange problem because the previous example “example.C” of page 361 works very well. I have checked the code and its’ right infact I have not any problem to compile.
I attach my code:

EXAMPLE2.CXX

#include <TApplication.h>
#include <TGClient.h> 
#include <TCanvas.h> 
#include <TF1.h> 
#include <TRandom.h> 
#include <TGButton.h> 
#include <TRootEmbeddedCanvas.h> 
#include "example2.h"

MyMainFrame::MyMainFrame(const TGWindow *p,UInt_t w,UInt_t h)
{
fMain = new TGMainFrame(p,w,h);
fEcanvas = new TRootEmbeddedCanvas("Rcanvas",fMain,200,200);
fMain->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,10,10,10,1));
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain,200,40);
TGTextButton *draw = new TGTextButton(hframe,"&Draw");
draw->Connect("Clicked()","MyMainFrame",this,"DoDraw()");
hframe->AddFrame(draw,new TGLayoutHints(kLHintsCenterX,5,5,3,4));
TGTextButton *exit = new TGTextButton(hframe,"&Exit","gApplication->Terminate(0)");
hframe->AddFrame(exit,new TGLayoutHints(kLHintsCenterX,5,5,3,4));
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
fMain->SetWindowName("Simple Example");
fMain->MapSubwindows();
fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow();
}

void MyMainFrame::DoDraw()
{
TF1 *f1 = new TF1("f1","sin(x)/x",0,gRandom->Rndm()*10);
f1->SetFillColor(19);
f1->SetFillStyle(1);
f1->SetLineWidth(3);
f1->Draw();
TCanvas *fCanvas = fEcanvas->GetCanvas();
fCanvas->cd();
fCanvas->Update();
}

MyMainFrame::~MyMainFrame()
{
fMain->Cleanup();
delete fMain;
}

void example()
{
new MyMainFrame(gClient->GetRoot(),200,200);
}

int main(int argc,char **argv)
{
TApplication theApp("App",&argc,argv);
example();
theApp.Run();
return 0;
}

EXAMPLE2.H

#include <TQObject.h> 
#include <RQ_OBJECT.h> 

class TGWindows;
class TGMainFrame;
class TRootEmbeddedCanvas;

class MyMainFrame {

RQ_OBJECT("MyMainFrame")

private:
TGMainFrame *fMain;
TRootEmbeddedCanvas *fEcanvas;
public:
MyMainFrame(const TGWindow *p,UInt_t w,UInt_t h);
virtual ~MyMainFrame();
void DoDraw();
};

I hope that someone can Help me.
Bye Patof

Hi Patof,
your class MyMainFrame must have a dictionary.
It can be produced either with rootcint (check guiviewer program
from $ROOTSYS/test) or with ACliC (check the page 328 of User’s Guide)

Regards. Valeriy