TGUI 0.7 is no longer supported, use a newer TGUI version instead.
This tutorial is about the functions that you find in the Widget base class. These functions are available for all widgets.
Every widget can be given a certain position. This position is relative to the position of the parent widget. If you really need the absolute position on the screen you can use the getAbsolutePosition function.
The size is also a property that all widgets are supposed to have. Important to know is that borders are never part of the size, they are drawn around the widget. To get the size including the borders (and including the title bar in child window) you can use the getFullSize function.
Instead of constants, the setPosition and setSize functions can also be given layouts as argument so that you can give your widget a relative position or size. If you tell widget B to have the same size as widget A then widget B will automatically change size when you give widget A a new size.
The enabled property determines if a widget receives events. If a widget is disabled, it will still be drawn but it will be unresponsive to your mouse clicks.
The visibility property determines if a widget is drawn. A hidden widget also no longer receives events, it is no longer there. The only way to have an invisible yet still functioning widget is to use ClickableWidget. Hiding and showing widgets is similar to adding and removing them, its just easier and faster. It can be very handy to put different screens into different Panel widgets and just hide all the panels except for one.
Every widget is visible and enabled by default.
What happens when widgets overlap? Which is the topmost widget? The answer is simple: the last widget that you added to the parent. You can manipulate the order in which widgets are drawn by using the moveToFront and moveToBack functions though.
You can make widgets semi-transparent with the setOpacity functions. It takes a float between 0 and 1 where 0 is completely transparent and 1 is fully opaque.