Re: TRootEmbeddedCanvas problem...

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Wed Aug 25 1999 - 17:49:34 MEST


Hi Marcelo,

   you need to give the desired layout hints. And also before calling
MapWindow() force the correct layout by calling 
main->Resize(main->GetDefaultSize());

See example below.

Cheers, Fons.


{
   TGMainFrame* main = new TGMainFrame(gClient->GetRoot(),900,700);

   TRootEmbeddedCanvas* fCanvas = new
TRootEmbeddedCanvas("canvas",main,800,600);
   TGLayoutHints *lo = new TGLayoutHints(kLHintsTop | kLHintsLeft |
kLHintsExpandX |
                                         kLHintsExpandY, 5, 5, 5, 5);

   main->AddFrame(fCanvas, lo);

   main->MapSubwindows();
   main->Resize(main->GetDefaultSize());

   main->MapWindow();
}




"Marcelo G. Munhoz" wrote:
> 
>     Hello,
> 
>     I'm trying to create a window with a canvas embedded in it using the
> following simple command lines:
> 
> 
> TGMainFrame* main = new TGMainFrame(gClient->GetRoot(),800,600)
> 
> TRootEmbeddedCanvas* fCanvas = new TRootEmbeddedCanvas("canvas",main,800,600)
> 
> main->AddFrame(fCanvas)
> 
> main->MapSubwindows()
> 
> main->MapWindow()
> 
>     It creates the window with the canvas in it, but when I put the mouse
> cursor  on the window I get several
> 
>  *** Break *** bus error
> 
>     It keeps showing this message while the cursor is on the window.
> 
>     What am I doing wrong?
> 
>     Thanks for any help,
> 
>                     Marcelo.
> 
> --
> Marcelo G. Munhoz
> Universidade de Sao Paulo - Brazil/
> Wayne State University
> phone: (313)5775419
> 
> 

-- 
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 04 2000 - 00:43:38 MET