Scrollbar on TGVerticalFrame

Dear all,

I have a program that is based on the root gui classes. It contains a TGVerticalFrame which houses quite some widgets and I have reached a point where not all the widgets fit on a small screen anymore.

How could I add a scrollbar to this frame so that the user can still access all the widgets by scrolling? Or is there another solution foreseen for such a case?

Thanks a lot for any hint,

Jens

Hi,

Use a TGCanvas as container instead of a TGCompositeFrame. Then you will have the scrollbars for free :wink:
You can take a look at the TGedEditor class to see how it is used.

Cheers, Bertrand.

Dear Bertrand,

thank you very much for the hint. Somehow I still lack a bit of understanding how the TGCanvas really works and the code you mention is still cryptic to me.
Is there a simple example somewhere which explains what the necessary steps are to use the TGCanvas and how to add widgets to it?

And as what do I actually use it? As a replacement of my TVerticalFrame, which in itself is part of another frame?

Thanks a lot,

Jens

Hi Jens,

I’ll prepare a simple example and I’ll post it here asap.

Cheers, Bertrand.

Hi Jens,

Here is a (more or less) simple example, textEntries2 showing how to use a TGCanvas. It is based on $ROOTSYS/tutorials/gui/textEntries.C, allowing to easily compare what is needed to obtain the required behavior. I also added several comments explaining the main differences.
Hope this will help. And if you still have questions, feel free to ask! :slight_smile:

Cheers, Bertrand.
textEntries2.C (5.28 KB)

Dear Bertrand,

thank you very much!! This worked right away for me. Really great support, you helped me a lot!

Best regards,

Jens