GUI: margin of embedded canvas

Hello,

I’m trying to create a GUI with an embedded canvas by adapting the example:
http://root.cern.ch/root/html/tutorials/gui/Slider3Demo.C.html

In lines 51-52 it says

My question is: How can I make the 30 px margin disappear?
I’ve been browsing the reference guide unsuccessfully and just can’t find out where to adjust this…

Thanks for help.
Greg

Hi Greg,

The “margins” are defined by the layout hint. In this case, replace this line:

fLcan = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 10, 10, 10);By (for example):

This will make the “margins” smaller. For more informations, just look at the TGLayoutHints documentation, or the “Layout Management” paragraph in the “Writing a Graphical User Interface” chapter in the Users Guide.

Cheers, Bertrand.

Hi Bertrand,

thanks for the quick reply, it made me realise that I was looking at the wrong spot. I actually do like the GUI margin around the canvas, but the TImage inside didn’t stretch across the whole canvas. Modifying the pad did the job:

embeddedCanvas->GetCanvas()->SetPad(-0.15, -0.15, 1.15, 1.15);

Cheers
Greg