Copyright © 2008, 2009 Arndt Roger Schneider
»extendBindtags« is the workhorse of the rtl toplevel management. »extendBindtags« adds a ToplevelMap bindgroup to the specified toplevel window.
ToplevelMap contains a single event handler for the Destroy event. The command destroyToplevel gets called when the toplevel window is destroyed.
»extendBindtags« also calls displayToplevel, to reuse the previous geometry settings for the given toplevel window.
»displayToplevel« gets called in response to a Destroy event. »destroyToplevel« records the current geometry of the used toplevel window and stores this geometry inside the option database under the resource name ».historyGeometry«.
The geometry value stored in ».historyGeometry« is later reused by displayToplevel . »destroyToplevel« only stores the width and height of a toplevel window, when it was altered by the user.
Example 9.10. historyGeometry
# The left-top corner of window ».main.top«: option add *top.historyGeometry {+100+100}
toplevel .main.top; extendBindtags .main.top # window »top« appears at position: +100+100.
Example 9.11. historyGeometry with Width and Height
option add *main.top.historyGeometry \ 200x450+100+100
toplevel .main.top; extendBindtags .main.top; # Window ».main.top« is 450 pixels height # and 200 pixels width, and appears at # position (100, 100).
Called from within extendBindtags. »displayToplevel« reads the ».historyGeometry« value for the provided toplevel window from the option database and alters the geometry of the toplevel window.
»displayToplevel« ensures that the displayed toplevel window appears inside the screen. It centers the toplevel window in the screen when the history values are off-screen.
The toplevel window is centered in the parent toplevel window, when no value for ».historyGeometry« is stored inside the option database. This however does not work for the Tk-root (.) window, children of the Tk-root window are centered in the screen.