Programmer Reference : Common Widgets : Main-window widgets : Main windows and geometry management
Main windows and geometry management
Like other composite widgets, a main-window widget manages the geometry of its children.

Main window
In order to manage its children correctly, a main-window widget must know which widget is the menu bar, which widget is the work region, and which widgets are the scroll bars. The setAreas:horizontalScrollbar:verticalScrollbar:workRegion: message explicitly tells the main window which of its child widgets are to be used for these purposes. In the following example, an empty menu bar and a drawing area widget are created as children of the main window. The setAreas: message is sent to the main window to explicitly set menuBar as the main window's menu bar, and drawingArea as the main window's work region. Because no scroll bars are being defined by the application, nil is passed in for the scroll bar arguments. For more information on menus and menu bars, see Menus.
| shell main menuBar drawingArea |
shell := CwTopLevelShell
createApplicationShell: 'shell'
argBlock: nil.
main := shell
createMainWindow: 'main'
argBlock: nil.
main manageChild.
menuBar := main
createSimpleMenuBar: 'menu'
argBlock: [:w | w buttons: #('')].
menuBar manageChild.
drawingArea := main
createDrawingArea: 'draw'
argBlock: [:w | w width: 300; height: 300].
drawingArea manageChild.
main
setAreas: menuBar
horizontalScrollbar: nil
verticalScrollbar: nil
workRegion: drawingArea.
shell realizeWidget.
Last modified date: 12/21/2017