Kirill Shileev wrote: > > Hi, > I'd like to ask few questions concerning TG* objects: > 1. What should be done in MyMainFrame::CloseWindow() in order to get > from main event loop without the application been terminated? > void MyMainFrame::CloseWindow() { delete this; // delete this mainframe gSystem->ExitLoop(); // return from TApplication::Run() } > 2. Is it nessesary to have the class inheriting from TQObject if i wonna > make the signal-slot connection to it methods? Connection to non ROOT > enable class is possible in interpreter, but i can't make this code > operational > as standalone. > You obviously don't have to inherit from TQObject if you won't make any signal/slot connections to its methods. What is the problem in stand alone code? Show me an example. > 3. In guitest.C, all TGLayoutHints objects are created without making > thiere pointers avalibale to the creator method. Does it mean that all > TGLayoutHints objects are deleted when corresponding widgets are? > Is it the same for TGString and TGTextBuffer? In general, is there any > list of objects been auto deleted availbale? In general it says in the method documentation if an object that is passed will be adopted. If an object is adopted its ownership will transfer to the receiving object and it will take care of deleting it. Typically TGStrings and TGTextBuffers are adopted. However, TGFrames and TGLayoutHints typically are not adopted since they can be reused in different locations. To cleanup all these objects I just add them to a TList which I delete in the dtor of the main widget. In guitest.C see fCleanup and fTrash as two such examples. > 4. Is it nessesary to provide layout hints for all widgets in > TGCompositeFrame in order to assure the Layout() facility workable? > There is a default layout hint that will be used if you don't specify a layout hint object in the Add() method. The properties of the default layout hint are the ones of a default TGLayout object (created by its default ctor). > 5. Is it possible to use any arbitrary method of parent class (TG* > family i mean) as a slot? Yes, just make sure that the arguments match (exclusive the default arguments). > 6. How to declare my own signal? Derive from TQObject or use the RQ_OBJECT macro and add a call like: Emit("CloseWindow()"); // emit "CloseWindow()" signal or Emit("PositionChanged(Int_t)", pos); to a method. This method will then emit the specified signal whenever Emit() is executed. Cheers, Fons. -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:39 MET