Syntax of Resource Files
The resource file is composed of nested statements; each statement is enclosed in parentheses, and contains either a keyword or the name of a dialog or component attribute followed by one or more values and/or other statements.
The top-level statement in a resource file for dialog must always be
(
Dialog dialog_name (other statements... )
)
where dialog_name is the name of the dialog itself. The dialog name is used to refer to the dialog from the source code of the application. The name of a dialog can be of any length, and contains alphanumeric characters and underscores. Case is ignored.
If the resource file contains only a layout, the top-level statement would be
(
Layout layout_name (other statements... )
)
instead. Collectively, the top statement describes the outermost container in the resource file.
The two statements that follow the name of the container are always Components and Resources.
The Components statement simply lists the types and names of the components that the dialog contains.
Components of type Layout, MenuPane, CascadeButton, Table, or Tree may have their own container-level statements following the Dialog statement. The formats of these statements are exactly the same as the Dialog statement.
If one of the components is a tab, the layouts that the tab contains are listed after the tab name in the Components part of the Dialog statement. Similarly, if one of the components is a MenuBar or a CascadeButton, the MenuPanes that it contains are listed after the MenuBar name in the Components part of the Dialog statement.
A Resources statement contains one or more attribute assignments. Each attribute assignment statement is of this form
(componentname.attributename value)
The Resource statement defines the attributes of the dialog and the components, and the Layout which defines the relative positions of the components, and the way in which they behave when the dialog is resized. If the component name is missing, the statement (for example, (.attributename value)) will be assumed to apply to an attribute of the dialog or layout itself. The attributes and their values are described in detail in the following sections of this section.
The last attribute statement in a Resources statement is a special one called .Layout. The value of a .Layout statement is always a single statement of type Grid. The Grid statement describes a flexible grid of rows and columns in which the components are placed; this defines the neighbor-relations between components, in other words their relative positions. The absolute positions, and the sizes, of the components may change as the grid stretches and shrinks in response to the user resizing the window containing the dialog. Components of type MenuPane do not require a .Layout statement.
The Grid statement contains the following values:
• Rows statement—lists the rows in the grid.
• Cols statement—lists the columns in the grid.
• Values list—specify the contents of each grid location in turn, reading left-to-right, top-to-bottom. Each of the values can be either
◦ The name of a component
◦ A Pos statement, to specify the row and column number of the next component in the list, if it is not in the next available location. A Pos statement allows you to skip some locations, leaving them empty.
◦ Another Grid statement, to show that the location contains several components on their own local grid.
The value of a Rows or Cols statement is a list of integers, one for each row or column. The value of the integer is 0 if the row or column cannot be resized when user resized the dialog. the integer value is 1 if it can be resized. (It is normal to set this to 1, so that all the components in the dialog will stretch when the dialog stretches.)
The size and position of the components within the grid is also partly determined by the values set for the
Attach and
Offset attributes described in more detail in the section
Master Table of Resource File Attributes.
|
Note:
|
Ensure that the resource file contains a new line after the last parenthesis, or else the function ProUIDialogCreate() will return an error.
|