|
This document is the first attempt to formulate principles of work
with Toolbook objects using tabular data. Because the structure of the
data in the table is defined by its heading this pseudo algorithmic
language got the name HeadingScript™ :) As often happens to get
the result is much easier than to explain how you have got it. So to
make things easier I included examples of real HeadingScript™
headings and you will find even more in the Samples
section. |
Operations with Toolbook objects |
|
Presented below is the list of HeadingScript™ reserved words
(object types) for operations with the corresponding Toolbook objects
- book
- viewer
- background
- page
- group
- field
- recordfield
- button
- combobox
- hotword
- ole
- stage
- clip
|
- angledLine
- arc
- curve
- ellipse
- irregularPolygon
- line
- paintObject
- picture
- pie
- polygon
- rectangle
- roundedRectangle
|
- bitmap
- cursor
- font
- icon
- menuBar
- palette
- sharedScript
|
Object Type in the table heading must be followed by object name,
which can be a simple string literal or return value of function.
Writing headings you should follow toolbook naming convention and
object hierarchy. HeadingScripts uses implicit references to toolbook
objects so the result will depend on current context.
Context:
book
This heading sequentially points to pages "Chapter 1",
"Chapter 2" and "Chapter 3" of current book |
Context:
page, background or group
points to button "Stop" of group "abc"
of current context
|
Context:
page, background or group
points to button "Stop" and
button "Start"of group "abc"
of current context |
Context:
book
This heading sequentially points to clips "avi 1", "avi
2" and "avi 3" of current book |
Context:
book
This heading points to and sets properties of button "Stop"
of group "abc" and field "title" of sequentially
"Chapter 1", "Chapter 2" and "Chapter
3" of current book |
|
|
Functions and constructors |
|
The second group of cell values recognized
by the compiler are references to the library functions. Their signs
are parentheses at the end of the string. Attempt to call non existent
function leads to fatal compilation error and stops execution of project
file. To identify the data that lay below the function the latter
is followed by the formal parameters. Compiler uses only their names,
so they can appear in any order or be omitted. For omitted parameters
NULL values will be used. Compiler also supports nested functions
when the return value of one function is used as a parameter of another.
The values of function parameters are taken either from the data section
of the table or the heading. Optionally you may use Windows Clipboard
for passing information to functions.
Generally speaking there are two main groups of library functions:
pure functions and object constructors.
- Functions return string values that can be assigned
to object properties or passed as a parameters to another function.
Also Functions can return values in a form of dynamic arrays that
can be assigned to properties.
- Constructors are functions that address toolbook
objects directly. They can change properties of objects or even
create a new ones. Usually they return object reference and change
context.
Below a several examples of how to use functions and constructors
in table headings. For complete list of CB library functions please
refer to Library Reference.

In this example image from file <File>
is imported as paintObject with name <Name>, borderStyle
<Border>. Additional parameters <Position> and <Alignment>
define the position of paintObject with respect to other objects
on the page. |

This is an example of creating
a hyperlink. Function hyperlink() returns a dynamic array,
which then is assigned to the _asym_hyperlinks
property of button "Next". Parameter <ToPage>
defines the target page of hyperlink.

MS Word table. Function WID_MultipleChoiceQuestion()
sets properties of corresponding catalog object with name
"Multiple Choice - LG 13"
|

Constructor CreatePagesFromTemplate() creates
3 pages from template page "T1" and names them "P1",
"P2", "P3"

Whereas you can write text to toolbook field using TEXT property,
the same operation with recordFields can be done only with the
help of special function WriteToRecordField().

Constructor CreateBitmap() imports file <File>
as bitmap resource with name <Name> and sets the keyColor
property of bitmap to <keyColor>. |
|
|
The next group of cell values recognized by the compiler
are the names of object properties.

Using this heading you can set three different properties of button
"1": assigning bitmap to normalGraphic property, creating
a hyperlink and enabling the button. |
|
Operations with Toolbook objects are very simple when
you have full reference to this object. For example, following script
sets text property of some field:
text of field "a" of page "b"
of book "c:\c.tbk"="abc".
This method is not very handy because every time you are addressing
some object on the page you need to specify the exact name of the
page and the book. OpenScript contains a special term this
that makes the process of building references easier by setting context
to book or page. For example scripts,
text of field "a" of page "b"
of this book="abc" or
text of field "a" of this page="abc"
do the same thing as the previous script but are much shorter. The
similar situation we have and with Content Builder. Here you can not
only specify the context like this book,
this page, this button
or this field (last two have no analogues
in OpenScript) but you are not obliged to specify them at all.
Content Builder analyzes objects and sets the content automatically
making all references to toolbook objects complete and correct. There
are several simple rules of setting context in Content Builder, as
well as several types of context.
- When CB starts execution of table it sets so called Global
context to book, or to this book.
Hence, first addressed object in the table must be book object,
such as page, viewer, background,
resource or book itself. You may
change the default global context using special commands.
- Objects that appear in the first column of the table set Local
context.
In
this example the local context is set sequentially to the listed pages
- All objects next to the right in the table use this Local
context as a reference point.
|