Split window widget
A split window (EwSplitWindow) arranges widgets within a composite. Users can resize the visible potion of the child widgets in a split window by dragging split bars. The orientation resource controls the layout of the widgets. A value of XmHORIZONTAL causes the child widgets to be added from left to right, in the order they are created; a value of XmVERTICAL causes the child widgets to be added from top to bottom in the order they are created. Split bars are automatically inserted between child widgets.
The childProportions resource can specify the initial size of the child widgets. The childProportions resource contains an array of integers indicating the relative percentage of the window to be occupied by each child. If the resource is not specified, the child widgets are sized equally within the window.
Users can reposition split bars by first pressing and holding mouse button one while the cursor is over a split bar and then moving the mouse to the desired position. Dragging one split bar towards another causes the visible portion of the enclosed widget to be reduced until it reaches a predefined minimum size as defined by the childMinimumSizes resource.
You can change the visual appearance of split bars using the splitBarForegroundColor, splitBarBackgroundColor, and splitBarThickness resources.
The following method creates a split window with three child widgets. Child widgets are given initial proportions and minimum sizes. Add this method to a class using the pool dictionaries CwConstants and EwConstants.
splitWindowExample
| shell splitWindow |
shell := CwTopLevelShell
createApplicationShell: 'Split Window Example'
argBlock: nil.
splitWindow := EwSplitWindow
createManagedWidget: 'splitWindow'
parent: shell
argBlock: [:w | w
width: 400;
height: 200;
orientation: XmHORIZONTAL;
childProportions: #(60 15 25) ;
childMinimumSizes: #(30 15 15)].
CwList
createManagedWidget: 'list1'
parent: splitWindow
argBlock: [:w | w
borderWidth: 0;
items: (Collection withAllSubclasses collect: :each | each name])].
CwList
createManagedWidget: 'list2'
parent: splitWindow
argBlock: [:w | w
borderWidth: 0;
items: (Collection class selectors collect: :each | each printString])].
CwList
createManagedWidget: 'list3'
parent: splitWindow
argBlock: [:w | w
borderWidth: 0;
items: (Collection selectors collect: :each | each printString])].
shell realizeWidget.
When you run the method by evaluating <class name> new splitWindowExample, you get the following:
Last modified date: 12/21/2017