Getting Started
Documentation
The best way to learn about zObjects is to read the zObjects Documentation.
Short Tutorial
All zObjects objects are APL functions contained in the zObjects.sf User Command File.
All zObjects functions start with a z or zz, followed by an uppercase letter, thus virtually eliminating any possible conflict with your own APL functions.
All you need to start using zObjects in your own workspace is to first load 2 fundamental functions from the zObjects.sf file:
]uload zObject zzInit /r
and then to run zzInit to register all the zObjects with the APL+Win system:
zzInit
Now imagine that you would like to create the following dialog box:
All you need to do is to write the following APL function:
∇ Example
[1] ←'ff'⎕wi'*Create' 'zForm'('*caption' 'Dialog Box')('*size'300 500)('minimumsize'200 400)'*Hide'
[2] ←'ff'⎕wi'*.ed1.Create' 'zSimpleEdit'('wherelc'⍬ 100 ⍬ 250)('caption' 'Field1:')('anchor'1 2 3)
[3] ←'ff'⎕wi'*.ed2.Create' 'zSimpleEdit'('wherelc' '>' '=' '=' '=')('caption' 'Field #2:')('anchor'1 2 3)
[4] ←'ff'⎕wi'*.ed3.Create' 'zSimpleEdit'('wherelc' '>' '=' '=' '=')('caption' 'Field 3:')('anchor'1 2 3)
[5] ←'ff'⎕wi'*.ed4.Create' 'zSimpleEdit'('wherelc' '>' '=' '=' '=')('caption' 'Field #4:')('anchor'1 2 3)
[6] ←'ff'⎕wi'*.ed5.Create' 'zSimpleEdit'('wherelc' '>' ⍬ '>' '>')('anchor'1 2 3 4)
[7] ←'ff'⎕wi'*.OK.Create' 'zButton'('wherelc' '=ed1' '<' ⍬ ⍬)('anchor'2 3)
[8] ←'ff'⎕wi'*.Cancel.Create' 'zButton'('wherelc' '>' '=' '=' '=')('anchor'2 3)
[9] ←'ff'⎕wi'AutoSize'
[10] ←'ff'⎕wi'CenterScreen'
[11] ←'ff'⎕wi'Show'
∇
and then to bring in the following zObjects objects:
]uload zForm zEdit zSimpleEdit zLabel zButton /r
Explanations
There is a lot of things happening in the short Example function code.
- first a zForm object is created and immediately hidden (line 1): note that zForm inherits from the standard APL+Win Form object
- its standard caption and size APL+Win properties are set (line 1)
- the custom minimumsize property is set: this help prevent the user froem resizing the form to less than 200 by 400 pixels (line 1)
- several zSimpleEdit objects are created (lines 2 to 6)
- a zSimpleEdit object inherits from zEdit which itself inherits from the standard APL+Win Edit object
- a zSimpleEdit object behaves like a zEdit object but gets yellow when it gets the focus and white when it loses the focus
- the wherelc properties allow to position objects relative to other previously positionned object and to align them perfectly, ensuring their distances are perfectly constant, etc.
- the anchor properties allow to ensure that objects are automatically and appropriately moved and resized when the user resizes the form
- the AutoSize method allows to force the form to resize itself appropriately to the controls it contains (line 9)
- the CenterScreen method centers the form on the screen (line 10)
- the Show method finally displays the form (line 11)
- note the margins which are the same all around the form
- note the gaps between controls which are the same in the whole form
It would be too long to enter into more details here, but if this short example raised your interest,
look at the zObjects extensive documentation for more details.
You can now resize the form and all controls will be automatically resized and/or moved: