RE: connecting signals & slots

From: Fine, Valeri <fine_at_bnl.gov>
Date: Sat, 27 Jan 2007 12:11:51 -0500


I seems to me I have to re-post the portion of my C++ example:  

 public:

    MyFitButton(const TGWindow *p, TGHotString *s, Int_t id=-1

     , GContext_t norm =GetDefaultGC()()
     , FontStruct_t font=GetDefaultFontStruct()
     , UInt_t option = kRaisedFrame|kDoubleBorder) 
     : TGTextButton (p, s, id, norm, font, options ) 
     , fGraph(0), fF1(0) {}

 

Hope it will not be screw by the mail-server.

Valeri


From: owner-roottalk_at_pcroot.cern.ch on behalf of Fine, Valeri Sent: Sat 1/27/2007 11:43 AM
To: Roger Mason; Philippe Canal
Cc: roottalk_at_pcroot.cern.ch
Subject: RE: [ROOT] connecting signals & slots

Hi Roger,

You did add a very strange thing:

       MyFitButton( TGButton() ) :

which is not a valid C++ statement, (Sorry, it was present with your first post but overlooked. One expected to answer the ROOT-related questions)

The correct version of the C++ class constructor that is derived from another C++ class (TGTextButton in your case) looks like this

  public:
    MyFitButton(const TGWindow *p, TGHotString *s, Int_t id=-1, GContext_t <https://exchange2000.bnl.gov/exchange/fine/Drafts1/RE:%20[ROOT]%20connecting%20signals%20%26%20slots.EML/ListOfTypes.html#GContext_t> norm =GetDefaultGC <https://exchange2000.bnl.gov/exchange/fine/Drafts1/RE:%20[ROOT]%20connecting%20signals%20%26%20slots.EML/TGButton.html#TGButton:GetDefaultGC> ()(), FontStruct_t font=GetDefaultFontStruct <https://exchange2000.bnl.gov/exchange/fine/Drafts1/RE:%20[ROOT]%20connecting%20signals%20%26%20slots.EML/TGTextButton.html#TGTextButton:GetDefaultFontStruct> (), UInt_t <https://exchange2000.bnl.gov/exchange/fine/Drafts1/RE:%20[ROOT]%20connecting%20signals%20%26%20slots.EML/ListOfTypes.html#UInt_t> option = kRaisedFrame|kDoubleBorder) : TGTextButton (p, s, id, norm, font, options ) , fGraph(0), fF1(0) {}

 public:

    MyFitButton(const TGWindow *p, TGHotString *s, Int_t id=-1

     , GContext_t norm =GetDefaultGC()()
     , FontStruct_t font=GetDefaultFontStruct()
     , UInt_t option = kRaisedFrame|kDoubleBorder) 
     :  TGTextButton (p, s, id, norm, font, options ) 
     , fGraph(0), fF1(0) {}



I hope you can find some elaborated explanation of the C++ syntax with your favorite C++ text book.

Best regards, Valeri


From: owner-roottalk_at_pcroot.cern.ch on behalf of Roger Mason Sent: Sat 1/27/2007 6:59 AM
To: Philippe Canal
Cc: roottalk_at_pcroot.cern.ch
Subject: Re: [ROOT] connecting signals & slots

Hello Ilka/Valeri/Philipe,

Philippe Canal <pcanal_at_fnal.gov> writes:

> Add
>       ClassDef(MyFitButton,1);
> at the end of your class declaration.
>

Now I get a different set of errors (things are looking up!):

/home/rmason/Programming/rootmac/RogersGUI.C: In constructor
'MyFitButton::MyFitButton(TGButton (*)())':
/home/rmason/Programming/rootmac/RogersGUI.C:145: error: expected
primary-expression before 'const'
/home/rmason/Programming/rootmac/RogersGUI.C:145: error: expected
primary-expression before '*' token
/home/rmason/Programming/rootmac/RogersGUI.C:145: error: 's' was not
declared in this scope
/home/rmason/Programming/rootmac/RogersGUI.C:145: error: expected
primary-expression before 'id'
/home/rmason/Programming/rootmac/RogersGUI.C:145: error: expected
primary-expression before 'norm'
/home/rmason/Programming/rootmac/RogersGUI.C:145: error: expected
primary-expression before 'font'
/home/rmason/Programming/rootmac/RogersGUI.C:145: error: expected
primary-expression before 'options'

The offending line is this:

   MyFitButton( TGButton() ) : TGTextButton ( const TGWindow *p,    TGHotString *s, Int_t id, GContext_t norm, FontStruct_t font,    UInt_t options )

          , fGraph(0), fF1(0) {}

There are some more errors following, but it is possible they are consequent on this first one.

By the way, what does 'ClassDef(MyFitButton,1);' do? I could not find it in any of my C++ books.

Thanks agaain for you help,

Roger Received on Sat Jan 27 2007 - 18:16:35 CET

This archive was generated by hypermail 2.2.0 : Sun Jan 28 2007 - 23:50:01 CET