The following example is the "Place Line" command. It has three sets of a ToggleButton followed by a Text field. The third set is hidden by default. We will not change the actual layout of this command's settings.
To migrate the settings to the Layout Manager, we start with a VStackLayout as its main layout and put a GridLayout within it with three rows. The GridLayout is not used as the main layout because we need to push the items up from the bottom when the Tool Settings dialog is docked, and we do that with a STRETCH(1) item at the end of a VStackLayout. The items on the row are surrounded by the GridRow and EndRow items. Each item is automatically assigned a sequential column number. Each row contains a ToggleButton, Label and Text field. The ToggleButton actually contains the label string. But for layout purposes, a Label item is added and specifies the "LABEL_LINKPREV" itemArg value in order to link to the previous item (the ToggleButton). Using this technique, the label string is pulled over to the Label item and the two items are "linked" for the focus model. This allows the ToggleButton to keep the label in its resource definition in case it is used outside a layout, but also allows the Label item to "link" to it and specify an independent column and size policy for layout purposes. In this case, the default "left alignment" is applied to the Label item. The "LABEL_LINKNEXT" itemArg value would pull the label string from the following item. The items in the third row are hidden by default; therefore, that row's height is 0. A STRETCH(1) is inserted as the last item in the VStackLayout to prevent unnecessary row height expansion when the Tool Settings dialog is docked.
This example uses the following principle and common techniques:
From MicroStation
From PPModules\2dModeling\Apps\consgeom\transkit\consgeom.r
The following example is the "Change Attributes" command.
These settings basically have 3 sections:
The sections are separated by a Separator item, which spans across the width of the dialog. The basic layout of the command's settings will remain unchanged.
To migrate the settings to the Layout Manager, we start with a VStackLayout as its main layout. For the first section, we use an HStackLayout. We use the HSTACKLAYOUTID_DialogButtons from ustation.rsc. To layout the label of the ToggleButton properly, a Label item is added and specifies the "LABEL_LINKPREV" itemArg value in order to link to the previous item (the ToggleButton). Using this technique, the label string is pulled over to the Label item and the two items are "linked" for the focus model. A SPACING(XC) is used before the IconCmdX to add spacing between the items. A STRETCH(1) is inserted as the last item in the HStackLayout to prevent unnecessary horizontal expansion. The first Separator is then added directly to the VStackLayout.
The next section contains several "Toggle Label: Editor" rows. The layout for this section is a GridLayout, and we use the GRIDLAYOUTID_3ColsToggleLabelSetting standard layout from ustation.rsc. Each "Toggle Label: Editor" set will be on a separate GridRow. This is accomplished using the GRID_ROW and END_ROW helper macros. We again add a Label item with the "LABEL_LINKPREV" itemArg for proper layout and sizing. After the GridLayout, the second Separator is added directly to the VStackLayout.
The final section is another GridLayout using the same GRIDLAYOUTID_3ColsToggleLabelSetting standard layout. The first GridLayout is similar to the ones in the previous section. But the last two have no editor. So we use a colSpan override value of '*' (AKA. the Star value), which indicates the cell will span the columns to the end of the row. The last item added to the main VStackLayout is a STRETCH(1) item to prevent vertical stretching.
Several of the older helper macros dealing with column position and row calculations could be removed after migrating to the Layout Manager.
This example uses the following principle and common techniques: