Assigning Styles and Properties to Objects

<< Click to Display Table of Contents >>

Navigation:  Programming Techniques > The Object-Oriented Style >

Assigning Styles and Properties to Objects

Previous pageReturn to chapter overviewNext page

Before you insert an object into a document - for example a text - you may specify all its properties (i.e. its style). Once the properties are set, all objects created afterwards will inherit this style, until you change a property.

 

Examples:

FontName = "Times New Roman"

FontSize = 12

Print(1, 1, "Hello World!")

Will print the text "Hello World!" with the font Times New Roman in 12 pt. size.

 

FontName = "Times New Roman"

FontSize = 12

Print(1, 1, "Hello World!")

TextBold = True

Print(1, 2, "What a nice day!")

TextItalic = True

Print(1, 3, "Hello Everybody!")

Will print the text "Hello World!" with the font Times New Roman in 12 pt. size and the text “What a nice day!” with the same font and font-size but in bold, and afterwards the text "Hello Everybody!" with the same font and font-size, but in bold and italic.

 

FontName = "Arial"

FontSize = 10

PenSize = 0.06

BkgMode = VBKG_GRD_LINE

BkgGradientStartColor = COLOR_LTYELLOW

BkgGradientEndColor = COLOR_ORANGE

PrintBox(1, 1, "Hello World!")

Will print the text "Hello World!" with the font Arial in 10 pt. size, surrounded by a box drawn with a 0.6mm thick pen and filled with a gradient running from light yellow to orange.

Note that the text object was inserted with the method "PrintBox" instead of "Print()" in the previous examples. You will also notice that font sizes are given in Point, whilst positions and the line thickness are given in metric units (inch units can also be used).

 

The examples above show VPE's basic principle for assigning properties to objects:

First, you set all global properties to the desired values and then you insert an object. When inserted, an object will automatically use all related global properties. After an object has been inserted into the document, its properties can not be modified (except in the Enterprise and Interactive Edition).

The global properties keep their values until they are changed. When opening a document, each global property has a default value which is indicated in the reference help files.

Each VPE document keeps and manages independently its own set of global properties.

 

NOTE: In the examples above we used the True-Type fonts "Times New Roman" and "Arial". These fonts are not available by default on other platforms than Windows and Mac OS. For details about using fonts on various platforms, please see “Fonts and Font Handling”.