Skip to main content

Layout Language in the upcoming 5.3.0 release

Up to now, Blaise 5 only supported visually adding layout instructions, but from 5.3.0 on it is also possible to use language to define your layout, like you could in earlier major versions of Blaise.

To accommodate for this, a layout section has been reintroduced in the datamodel source. The syntax in this section is similar to the layout section in older versions of Blaise, but not exactly the same.
For example, FROM .. TO constructions are no longer allowed, but instructions can now contain parameters, and instructions can be assigned to (local) types.

You are not required to use the layout section. It is still possible to define all layout in the Layout Designer, but as soon as the datamodel contains any layout section, existing layout will be overwritten by the layout generated based on the layout sections (as soon as the datamodel is prepared). The language beats the visual instructions, so to say.
It will be possible to apply changes to the layout using the Layout Designer and generate the layout statements back into the datamodel, but this will not be fully automatic as comments and conditional defines that might be inside the original layout sections cannot be generated. The new sections can be manually reviewed and edited using a wizard before updating.

 

DATAMODEL LayoutSample
PRIMARY
ID
TYPE
TPhoneNumber = STRING[12]

FIELDS
ID "Please enter your identification number": 0..1000
FirstName "What's your first name?": STRING[20]
BirthDate "What's your birthdate?": DATETYPE
YourAge "Your age is": INTEGER[3]
PhoneNumber "What's your phone number": TPhoneNumber
Income "What's your income?": (Below10k "0 to 9,999 dollars",
Below20k "10,000 to 19,999 dollars",
Below30k "20,000 to 29,999 dollars",
Below40k "30,000 to 39,999 dollars",
Below50k "40,000 to 49,999 dollars",
Below60k "50,000 to 59,999 dollars",
Above60k "60,000 or more")
RULES
ID
FirstName
BirthDate
YourAge := Age(BirthDate)
YourAge.SHOW
PhoneNumber
IncomeLAYOUT
BEFORE FirstName NEWPAGE
AT TPhoneNumber RESPONSEVALUE TEMPLATE StringTextBox(EditMask:='(000)-0000000')
LAYOUTSET "CAPI-Large"
BEFORE FirstName ITEMSPERPAGE := 8
AT FirstName FIELDPANE TEMPLATE Vertical(Width:='900')
AT BirthDate CRITICAL
AT BirthDate RESPONSEVALUE TEMPLATE DateControl(Appearance:='TextBox')
AT Income DATAVALUE TEMPLATE AnswerList(Arrangement:='2 Columns')
PRIMARY
AT ID FIELDPANE TEMPLATE Horizontal
LAYOUTSET "Capi-Small"
BEFORE FirstName ITEMSPERPAGE := 1
AT FirstName FIELDPANE TEMPLATE Vertical(Width:='300')
ENDMODEL

Gaining deeper understanding