Adding a vertical scrollbar to TGSkeleton

I’m primarily a Linux user, but recently I built ROOT on Windows 7 using Visual C++ according to the following resources. … Debug.html … uildscript

Then I attempted to use François-Xavier Gentit’s Skeleton ( to generate a new ROOT VC++ project. Skeleton compiles and executes without error, but I need to add a vertical scrollbar to its TGMainFrame. I know this should be simple and that my trouble probably reflects a poor understanding of the ROOT GUI library, but when I add a scrollbar by mimicking how TGCanvas uses scrollbars, the new scrollbar appears but is completely non-functioning. What is the correct way to add a vertical scrollbar in the context of this code? (The code is available at the above link for Skeleton.)

Many Thanks,


Hi Evan,

You cannot just add scrollbars to a main frame (well, you can, but then it is much more complex to handle). Just use TGCanvas instead. To try, just replace this line (in TGSkeleton.cxx):

By these few lines:

  fCan = new TGCanvas(this, width, 200, kFixedWidth);
  AddFrame(fCan, new TGLayoutHints(kLHintsExpandY | kLHintsExpandX));
  fFrameText   = new TGVerticalFrame(fCan->GetViewPort(), width, 200, kChildFrame | kRaisedFrame);

And don’t forget to add the declaration of the TGCanvas as member of the TGSkeleton class, e.g.:

class TGSkeleton : public TGMainFrame {


  TGCanvas        *fCan;              //provides scroll bars
  TGVerticalFrame *fFrameText;       //Frame containing TGTextEntry

You can also change the fFTLayout as shown here:

(to avoid increasing size of the text entries)

Cheers, Bertrand.

Thanks Bertrand – That was exactly what I needed.