Hi Andi, Does your MyMainFrame derive from TGMainFrame ? This seems to be the case from your first message. In this case, as Valeriy said, your constructor needs to mass the (p,w,h) arguments to TGMainFrame like so: class MyMainFrame : public TGMainFrame { ... }; MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h):TGMainFrame(p, w, h) { .... } The example MyMainFrame in the Users' Guide does not derive from TGMainFrame, but instead uses a member pointer to a TGMainFrame like so: class MyMainFrame { TGMainFrame *fMainFrame; .... }; MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) { fMainFrame = new TGMainFrame(p, w, h); } This is really two ways of doing the same thing, and certainly does not affect the result of all those (fantastically easy to use) TGLayoutHints. Note that if you make MyMainFrame derive from TGMainFrame AND add a member pointer which you initialise with fMainFrame = new TGMainFrame(p, w, h); then you will actually have two GUI floating around for the price of one !! HTH John Andreas WILDAUER wrote: >Hi Valeriy, > >Thanks for your answer but I don't get it (and I don't get the error message). > >There are two reasons why I need it to work like this: >1) if I don't have a "name" for my mainframe (here its fMain) the whole GUI >look is a mess (don't know why). I thinks it's something with this >TGLayoutHints things. >2) the example in the ROOT manual 3.05 page 311 does exactly the same >(and I suppose it should work) > >it does: > >MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) > { >// Create a main frame >fMain = new TGMainFrame(p,w,h); >. >// and then I can do things like >fMain->AddFrame(... > >// instead of only >AddFrame(... >// which also works, but the layout is a mess > >Cheers >Andi > > > >On Wednesday 23 July 2003 18:44, Valeriy Onuchin wrote: > > >> Hi Andreas, >> >>MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) >>{ >>... >> >>is equal to >> >>MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) : >>TGMainFrame() { >>... >> >>TGManFrame class doesn't have default constructor, i.e. >>TGMainFrame::TGMainFrame() >> >>Yours compler complains for the same: >>"main.c++:29: no matching function for call to `TGMainFrame::TGMainFrame >>()'" >> >>HTH. Regards. Valeriy >> >> >> >>>Hi ROOTERS, >>> >>>how come the following works: >>> >>>MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) >>> >>>: TGMainFrame(p, w, h) >>> >>>{ >>> >>>... code >>> >>>} >>> >>>but the following doesn't: >>> >>>MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) >>>{ >>> >>>fMain = new TGMainFrame(p, w, h); >>>... code >>> >>>} >>> >>>wher fMain is of course in the .h file as: >>> >>>TGMainFrame *fMain; >>> >>>I get the following error: >>>main.c++: In method `MyMainFrame::MyMainFrame (const TGWindow *, >>>unsigned int, unsigned int)': >>>main.c++:29: no matching function for call to `TGMainFrame::TGMainFrame >>>()' >>>/afs/cern.ch/sw/root/v3.05.04/rh73_gcc2952/root/include/TGFrame.h:369: >>>candidates are: >>>TGMainFrame::TGMainFrame (const TGWindow *, unsigned int, unsigned int, >>>unsigned int = kVerticalFrame) >>>/afs/cern.ch/sw/root/v3.05.04/rh73_gcc2952/root/include/TGFrame.h:410: >>>TGMainFrame::TGMainFrame (const TGMainFrame &) >>> >>> >>>Thanks in advance >>>Andi >>> >>>======================================================================= >>>Andreas Wildauer >>> CERN/EP ATC, mailbox E25310, CH-1211 Geneva 23, Switzerland >>> office 40 3-D06 >>> email Andreas.Wildauer@cern.ch >>> tel +41 22 76 71779 >>>======================================================================= >>> >>> > > > -- ganil logo <http://www.ganil.fr> John D. Frankland <mailto:frankland@ganil.fr> Beam Coordinator GANIL B.P. 55027 14076 CAEN Cedex 05 *tel:* +33 (0)231454628 *fax:* +33 (0)231454665
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET