Layout
This property applies only to docking windows and allows you to set and retrieve the layout of a docking window.
The isCOBOL docking window layout manager recursively arranges its components in row and column groups called Splits. Elements of the layout are separated by gaps called Dividers. The overall layout is defined with a simple tree model. Named Leaf nodes represent the space allocated to a component that was added with a constraint that matches the Leaf's name. Extra space is distributed among row and column siblings according to their weight. The weight value varies from 0.0 to 1.0. If no weights are specified then the last sibling always gets all of the extra space, or space reduction.
Nodes are represented by parenthetical expressions whose first token is one of ROW/COLUMN/LEAF. ROW and COLUMN specify horizontal and vertical Split nodes respectively, LEAF specifies a Leaf node. A Leaf's name and weight can be specified with attributes, name=myLeafName weight=myLeafWeight. Similarly, a Split's weight can be specified with weight=value. For example, the following expression generates a horizontal Split node with three children: the Leafs named left and right, and a Divider in between:
(ROW (LEAF name=left) (LEAF name=right weight=1.0)) |
Dividers must not be included in the string, they're added automatically as needed. Because Leaf nodes often only need to specify a name, one can specify a Leaf by just providing the name.
The previous example can be written like this:
(ROW left (LEAF name=right weight=1.0)) |
Here's a more complex example. One row with three elements, the first and last of which are columns with two leaves each:
(ROW (COLUMN weight=0.5 left.top left.bottom) (LEAF name=middle) (COLUMN weight=0.5 right.top right.bottom)) |
It’s also possible to specify the minimum number of pixels that the dockable window must retain when it’s resized inside of the docking window with the optional attribute minpixel. The minpixel attribute acts on the height or on the width depending on the kind of node where it appears. In the example below, the dockable window on the right cannot be horizontally resized under 30 pixels:
(ROW left (LEAF name=right weight=1.0 minpixel=30)) |
Example - Display a docking window with a layout
working-storage section. 77 var-layout pic x(200). 77 var-leaf1 pic x(10). 77 var-leaf2 pic x(10). 77 h-docking handle of window. ... procedure division. ... move "(ROW (COLUMN (LEAF name=tl weight=0.5)"& "(LEAF name=bl weight=0.5) weight=0.5)"& "(COLUMN (LEAF name=tr weight=0.5)"& "(LEAF name=br weight=0.5) weight=0.5))" to var-layout. display docking window resizable lines 24 size 75 min-lines 24 min-size 75 title "Docking Window" layout var-layout handle h-docking. |