Re: Events, events, always events..

From: Ilka Antcheva <Ilka.Antcheva_at_cern.ch>
Date: Wed, 24 Aug 2005 17:28:56 +0200


Hi Giorgio,

Make the slot TGAppMainFrame::CloseWindow() public.

Change the default setting given by system.rootrc file:

# Path used by dynamic loader to find shared libraries and macros.
# Paths are different for Unix and Windows. The example shows the defaults
# for all ROOT applications for either Unix or Windows.
Unix.*.Root.DynamicPath:    .:$(ROOTSYS)/lib
Unix.*.Root.MacroPath:      .:$(ROOTSYS)/macros
WinNT.*.Root.DynamicPath:   .;$(ROOTSYS)/bin;$(PATH)
WinNT.*.Root.MacroPath:     .;$(ROOTSYS)/macros

to ones you wish to have.

Cheers, Ilka

Giorgio De Nunzio wrote:

>Hi all! Me again, back from the seaside (but returning there this evening
>till September :-)
>
>I have a problem with events in a MDI scheme.
>
>In two words, my problem is that, connecting a CloseWindow() member to the
>CloseWindow slot of a TGMainFrame, works when my script is interpreted,
>while it
>does not when it is compiled: in this case I get message:
>
> Error in <TQObject::CheckConnectArgs>: slot TGAppMainFrame::CloseWindow()
>does not exist
>
>The following notes are probably useless, you'll perhaps give me an answer
>by simply reading the error message above :-) ! Anyway I prefer to
>give you the details just in case..
>Ah, I am including the three final files: code, include, linkdef, in case
>someone wants to try!
>
>Here is all the procedure that leads me to the problem.
>
>First, take mditest.C, and execute it with
>
> .x mditest.C
>
>(by the way, how can I tell ROOT that scripts can be elsewhere than
>$ROOTSYS/macros? Everytime I try a tutorial, I have to take it from its
>directory and put it into the macros directory.. I'll discover this myself
>when I
>have some spare minutes, anyway ;-)
>So, back to the main problem!
>
>Executing by cint this code works nicely and we have our MDI program
>working.
>
>Now note that closing this program by File->Exit goes back to the linux
>command line (because CloseWindow() is executed, and this method
>contains gApplication->Terminate(0)) while clicking on the X icon closes the
>program but remains in
>ROOT.
>
>To overcome this slight inconsistency, add this line:
>
> fMain->Connect("CloseWindow()", "TGAppMainFrame", this,
>"CloseWindow()");
>
>immediately after
>
> fMain = new TGMainFrame(p, w, h, kVerticalFrame);
>
>and execute the code again.
>
>Now also clicking on the X icon closes ROOT, which means we are calling
>CloseWindow().
>
>So, the code is right.
>
>COMPILATION
>-----------
>
>Now let us try and compile this code.
>We have to separate the definitions (to be put into a .h file) from the
>implementation, so that rootcint can build up its dictionary (ah, I could
>perhaps simply put everything in the .h file leaving the .cxx one almost
>empty).
>
>It is simple: cut the mditest.C file into two parts, say mditest.h from the
>start to (and excluding) the first implementation line:
>
> TGAppMainFrame::TGAppMainFrame(const TGWindow *p, int w, int h)
>
>and mditest.cxx from that point on.
>
>Add line
> ClassDef(TGAppMainFrame, 1)
>to mditest.h (within the TGAppMainFrame class definition), and lines
> #include mditest.h
> ClassImp(TGAppMainFrame)
>to mditest.cxx.
>
>Create file mditest_linkdef.h:
>
>#ifdef __CINT__
>#pragma link off all globals;
>#pragma link off all classes;
>#pragma link off all functions;
>#pragma link C++ class TGAppMainFrame+;
>#endif
>
>Uh! I hope you are having patience...
>
>Now, ROOT, then .x mditest.cxx: it works exactly as before (CloseWindow() is
>called when X is clicked).
>
>Compile!
> .L mditest.cxx+
>
>execute:
> .x mditest.cxx+
>
>Now exiting by the X icon does not use CloseWindow(). CINT reply when
>executing the code is:
>
> Error in <TQObject::CheckConnectArgs>: slot TGAppMainFrame::CloseWindow()
>does not exist
>
>I know that the Event class is added to the CINT dictionary by the rootcint
>utility (see the ROOT user's guide) so I think something is wrong with my
>dictionary generation. But.. what?
>
>Sorry for being so verbose!
>Thanks!
>
>Giorgio
>
>
Received on Wed Aug 24 2005 - 17:29:25 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:12 MET