Customizing the metamodel : Modifying the aesthetic look of dialogs : LAYOUT command : Example of the LAYOUT command
  
Example of the LAYOUT command
In the following example, we examine the LAYOUT command's effect inside CHAPTER and GROUP statements within a newly defined, user-specified definition.
RENAME DEFINITION "User 1" TO "My Definition"
DEFINITION "My Definition"
{
LAYOUT { COLS 3 ALIGN OVER TAB }
PROPERTY "My Property 1"{ EDIT Text Length 10}
PROPERTY "My Property 2"{ EDIT Text Length 10}
GROUP "No Layout Specified" {
PROPERTY "My Property 3"{ EDIT Text Length 10}
PROPERTY "My Property 4"{ EDIT Text Length 10}
PROPERTY "My Property 5"{ EDIT Text Length 10}
PROPERTY "My Property 6"{ EDIT Text Length 10}
}
CHAPTER "4-Col Layout"
LAYOUT { COLS 4 ALIGN OVER TAB }
GROUP "2-Column Group" {
LAYOUT { COLS 2 ALIGN OVER TAB }
PROPERTY "G1"{ EDIT Boolean LENGTH 1 DEFAULT "F"}
PROPERTY "G2"{EDIT Boolean LENGTH 1 DEFAULT "F"}
PROPERTY "G3"{ EDIT Boolean LENGTH 1 DEFAULT "F"}
PROPERTY "G4"{ EDIT Boolean LENGTH 1 DEFAULT "F"}
}
GROUP "1-Column Group" {
LAYOUT { COLS 1 ALIGN OVER TAB }
PROPERTY "Group Property 5"{ EDIT Text Length 10}
PROPERTY "Group Property 6"{ EDIT Text Length 10}
}
PROPERTY "My Property 7"{ EDIT Text Length 5}
PROPERTY "My Property 8"{ EDIT Text Length 5}
PROPERTY "My Property 9"{ EDIT Text Length 5}
PROPERTY "My Property 10"{ EDIT Text Length 5}
PROPERTY "My Property 11"{ EDIT Text Length 1200}
PROPERTY "My Property 12"{ EDIT Text Length 1200}
CHAPTER "2-Column Layout"
LAYOUT { COLS 2 ALIGN LABEL TAB }
PROPERTY "My Property 13"{ EDIT Text Length 10}
PROPERTY "My Property 14"{ EDIT Text Length 10}
PROPERTY "My Property 15"{ EDIT Text Length 10}
PROPERTY "My Property 16"{ EDIT Text Length 10}
PROPERTY "My Property 17"{ EDIT Text Length 10}
GROUP "3-Column Group" {
LAYOUT { COLS 3 ALIGN OVER TAB }
PROPERTY "G5"{ EDIT Boolean LENGTH 1 DEFAULT "T"}
PROPERTY "G6"{EDIT Boolean LENGTH 1 DEFAULT "T"}
PROPERTY "G7"{ EDIT Boolean LENGTH 1 DEFAULT "T"}
PROPERTY "G8"{ EDIT Boolean LENGTH 1 DEFAULT "T"}
}
CHAPTER "3-Column Layout"
LAYOUT { COLS 3 ALIGN OVER TAB }
PROPERTY "My Property 18"{ EDIT Text Length 10}
PROPERTY "My Property 19"{ EDIT Text Length 10}
PROPERTY "My Property 20"{ EDIT Text Length 10}
PROPERTY "My Property 21"{ EDIT Text Length 10}
PROPERTY "My Property 22"{ EDIT Text Length 10}
PROPERTY "My Property 23"{ EDIT Text Length 10}
}
We examine this USRPROPS.TXT code in the figures below. The first figure shows that the top layout command in the Definition, LAYOUT { COLS 3 ALIGN OVER TAB }, is ignored, since it is not assigned to any CHAPTER and it cannot override the layout of the first “Introduction” tab, which is set to default to a 1-column layout.
First LAYOUT command is ignored since it is not assigned to a CHAPTER (tab)
The second tab in the dialog is specified by the CHAPTER "4-Col Layout" command. Its layout is specified as being 4-columns, with the title or label of each control placed over the control (CHAPTER "4-Col Layout" LAYOUT { COLS 4 ALIGN OVER TAB }.
You can see from the figure below that even entire groups (such as “2-Column Group” and “1-Column Group” are laid out in the Chapter within a 4-column layout, as are properties (such as “My Property 7" through “My Property 10". Properties that are too wide to fit within the 4-column layout scheme are laid out by 1 column (such as “My Property 11" and “My Property 12", which are both Length 1200).
4-column chapter containing 2-column and 1-column groups
The 2-column Chapter, similarly, contains properties laid out in 2 columns, including a Group, within which properties are laid out in 3 columns.
2-column chapter containing 3-column group
The final Chapter contains properties in a 3-column layout. Note that these properties are narrow enough (Length 10) to fit in 3 columns.
2‑column chapter containing 3-column group
If any of these properties were too wide to fit in a 3-column layout, then that property would be laid out independently of the others, in a 1-column format. Changing “My Property 20" from LENGTH 10 to LENGTH 100 causes its control to be displayed as shown in the figure below. All other properties in the dialog remain laid out in 3-columns.
2-Column Chapter Containing 3-Column Group, with one wide property