Re: "slot does not exist" error upon file reload in interpreted setting

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Mon, 12 Oct 2009 16:32:02 +0200


Hi Ashley,

this is now (finally!) fixed in ROOT's trunk.

Cheers, Axel.

Mills, Ashley, VF-Group wrote on 06/30/2009 02:19 PM:
> Hi,
>
> I've just started to try and use root, but come across a simple problem
> with example.C from the "Writing a Graphical User Interface" tutorial
> (file is shown at end of email). The following command sequence
> illustrates the problem:
>
> *******************************************
> * *
> * W E L C O M E to R O O T *
> * *
> * Version 5.22/00 17 December 2008 *
> * *
> * You are welcome to visit our Web site *
> * http://root.cern.ch *
> * *
> *******************************************
>
> ROOT 5.22/00 (trunk_at_26997, Jan 05 2009, 10:56:00 on win32)
>
> CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] .cd D:\root\fading
> root [1] .L example.c
> root [2] example()
> <the example loads and works correctly, and at this point I close the
> example simply by clicking on the x in the top right hand corner>
> root [3] .U example.c
> root [4] .L example.c
> root [5] example()
> Error in <TQObject::CheckConnectArgs>: slot MyMainFrame::DoDraw() does
> not exist
> root [6]
> <example is shown but the draw button doesn't work because of the slot
> problem indicated above>
>
> Is it something to do with me closing the example the first time using
> the normal window closure mechanism? Why does it work after loading the
> first time, but not the second?
>
> The reason I want to use such a sequence is because I'm editing in gvim
> outside of root and so want to unload and reload the file frequently.
> (If anyone has any suggestions for a better working methodology, that
> would be appreciated).
>
> Thanks
>
> Ashley Mills
>
>
> --- example.C
>
> // example.C
> #include <TGClient.h>
> #include <TCanvas.h>
> #include <TF1.h>
> #include <TRandom.h>
> #include <TGButton.h>
> #include <TGFrame.h>
> #include <TRootEmbeddedCanvas.h>
> #include <RQ_OBJECT.h>
> 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();
> };
>
> MyMainFrame::MyMainFrame(const TGWindow *p,UInt_t w,UInt_t h) {
> // Create a main frame
> fMain = new TGMainFrame(p,w,h);
>
> // Create canvas widget
> fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,200,200);
> fMain->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX|
> kLHintsExpandY,
> 10,10,10,1));
>
> // Create a horizontal frame widget with buttons
> 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));
>
> // Set a name to the main frame
> fMain->SetWindowName("Simple Example");
> // Map all subwindows of main frame
> fMain->MapSubwindows();
> // Initialize the layout algorithm
> fMain->Resize(fMain->GetDefaultSize());
> // Map main frame
> fMain->MapWindow();
> }
>
> void MyMainFrame::DoDraw() {
> // Draws function graphics in randomly choosen interval
> 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() {
> // Clean up used widgets: frames, buttons, layouthints
> fMain->Cleanup();
> delete fMain;
> }
>
> void example() {
> // Popup the GUI...
> new MyMainFrame(gClient->GetRoot(),200,200);
> }
> <mailto:ashley.mills_at_vodafone.com>
>
Received on Mon Oct 12 2009 - 16:26:04 CEST

This archive was generated by hypermail 2.2.0 : Tue Oct 13 2009 - 11:50:02 CEST