Widget Mapping and Layering
Widgets exist in one of two basic states: unmapped or mapped. When a widget is first instantiated (created), it is unmapped, meaning that it exists but has not yet been displayed. Once it is managed by a geometry manager, a widget becomes mapped: its size and position on the display have been calculated, and it has been rendered on the display.
All geometry managers have a “forget” method that removes a widget from the display without destroying it. If the widget is remanaged it reappears on the display exactly where it used to be.
You can also unceremoniously map a widget without regard to its geometry manager:
$widget->MapWindow;
Doing this may confuse the geometry manager (pack
,
grid
, place
,
form
) that thinks it is managing the widget.
Similarly unceremoniously, you can yank a widget from the display:
$widget->UnmapWindow;
This unmaps the widget. It does for any widget what
$widget->withdraw
does for Toplevel widgets. It
might confuse the geometry manager that thinks it is managing the
widget.
Widgets have
a stacking order (see Chapter 2 and Chapter 23 for details), which you can raise or lower
using the raise
and lower
methods.
$widget->raise(?aboveThis?);
If the
aboveThis
argument is omitted, the command raises
$widget
so it is above all its siblings in the
stacking order (it will not be obscured by any siblings and will
obscure any siblings that overlap it). If
aboveThis
is specified, it must be a widget reference of a window that is either ...
Get Mastering Perl/Tk now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.