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

From: Bertrand Bellenot <Bertrand.Bellenot_at_cern.ch>
Date: Tue, 30 Jun 2009 15:10:53 +0200


Hi Ashley,  

We are aware of this problem and are working on this limitation.

Thanks for the report and sorry for the trouble.

We'll keep you in touch.  

Cheers, Bertrand.    

From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of Mills, Ashley, VF-Group
Sent: Tuesday, June 30, 2009 14:19
To: roottalk_at_lxbuild091.cern.ch
Subject: [ROOT] "slot does not exist" error upon file reload in interpreted setting  

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:  


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

#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); } Received on Tue Jun 30 2009 - 15:11:03 CEST

This archive was generated by hypermail 2.2.0 : Tue Jun 30 2009 - 17:50:02 CEST