newObjects Active Label TextLabel object

Drawing object (element).

oTextLabel = VisiLabel.Element(x);
oTextLabel = VisiLabel(x); 

The TextLabel object displays a single line of text. It supports different fonts, text decorations and can be rotated to any angle.

Text command:

The text commands are used to represent objects and their settings in the saved label data. When the label is saved or uploaded (see How to Download and Upload) text commands are generated and packed in the specified format (see Misc.SaveFormat). The representation of the entire label with its elements can be also obtained programmatically through VisiLabel.TextCommands and VisiLabel.ObjectParams. The commands have simple syntax and can be generated from the application (just like a HTML output) where appropriate allowing the developer implement different tasks in any suitable way. The label can be instantiated from set of text commands (see the list of the different options to do this). The text commands can be feed into the control programmatically (see VisiLabel.TextCommands) or a download can be invoked (see VisiLabel.Src and VisiLabel.MergeSrc).

A Text label element object is represented by a LABEL text command. 

Members reference:

X Sets/Gets the horizontal position of the element's reference point. See the label coordinate space. The property is long integer.
obj.X = value;
v = obj.X;
Y Sets/Gets the vertical position of the element's reference point. See the label coordinate space. The property is long integer.
obj.Y = value;
v = obj.Y;
Color Specifies the foreground color of the element. See Active Label colors.
obj.Color = 0x00FF00; // Sets the color to green
v = obj.Color;
BkColor Specifies the background color of the element. See Active Label colors.
obj.BkColor = 0x0000FF; // Sets the background color to red
v = obj.BkColor;

If the element supports transparency the background color will not have effect when the element is drawn transparently. For example the text labels can be drawn opaque and transparent. The background color will actually show on the screen if the particular element is drawn opaque. 
Transparent Specifies the draw mode: True - Transparent, False - opaque
obj.Transparent = true; // Makes the element transparent
v = obj.Transparent;

The effect of this property may differ for the different element types. For example a text label or a text box will draw the text background if this is set to false. Otherwise they will draw only the text not touching the background.
Alignment Specifies the text alignment: -1 - left (default); 0 - centered; 1 - right.
obj.Alignment = 1; // Make the text alignment
vcuralign = obj.Alignment;

For text labels the alignment is actually the location of the element's reference point (i.e. the point which is specified by the X and Y properties - see Label coordinate space).
FontFace String. Specifies the face name for the font used in the element.
obj.FontFace = "Arial"; // Specifies font face Arial
vfontface = obj.FontFace;

In WEB applications you should use fonts that are installed on the client machines. Because Active Label is most often used in intranets this is not a problem, but the administrators should make sure all the fonts in use are installed on the workstations.
FontSize Specifies the size of the font used in the element. The size is specified in the current measurement units.
obj.FontSize = 300; // If the default settings are in effect this specifies font size of 3 millimeters
vsize = obj.FontSize;

Note that in contrast with the most applications Active Label uses the same measurement units for all the sizes and locations - including the font size. We believe this is more convenient when the content must be fit on very small sized areas such as sticky labels.
Charset Specifies the font charset to be used. See the remarks below.
obj.Charset = 204; // Sets cyrillic charset
v = obj.Charset;

Active Label is implemented for the ANSI subsystem and not for the UNICODE subsystem. This makes it compatible with all the Windows versions - even Windows 95 without need of additional system updates. Thus when working with fonts that contain characters for multiple alphabets you will need to specify which one to use. Each element may have different charset thus you can display elements in different languages on the same label. See also the CodePage property.
Bold Boolean. Specifies if the font used by the element is bold.
obj.Bold = true; // Make the text bold
vbold = obj.Bold;
Itallic Boolean. Specifies if the font used by the element is itallic.
obj.Itallic = true; // Make the text itallic.
vbold = obj.Itallic;
Underline Boolean. Specifies if the font used by the element is underlined.
obj.Underline = true; // Make the text underlined.
vbold = obj.Underline;
Orientation Long integer. Specifies the text orientation in degrees. The angle grows in clockwise direction.
obj.Orientation = 90; Rotate the text 90 degrees clockwise
vdirection = obj.Orientation;
Text String. Specifies the text displayed in the text label.
obj.Text = "My Text Label";
vtext = obj.Text;
Standard drawing object (element) properties
ElementType Returns an integer constant which describes the element type:
1 - Text Label
2 - Text box
3 - Simple shape
4 - Symbol
5 - Image
6 - Barcode
et = obj.ElementType;
This property is a must when you want to enumerate the elements on the label and perform certain actions on some of them (for example invoke save for the image elements, or check the correctness of the text elements and so on). 
VisiLabel Returns the VisiLabel object on which the element resides.
Index Returns the element's index in the elements stack. 
i = obj.Index;
For example you can use later VisiLabel.Element(i) to obtain the same element.
PropInfo Implements simple type information interface which allows the application to obtain a list of properties supported by the object.

v = obj.PropInfo( nProp [, infoType]);
nProp - >= 0 integer value - the property index for which to obtain infromation. See the remarks.
infoType - What information to return. Currently supported values are:
   0 - the name of the property
   1 - the type of the property as VARTYPE constant.
   2 - the property description.
This is used mostly for internal purposes, but can be useful for some advanced applications as well. The PropInfo can be called with nProp argument ranging from 0 to a certain positive number N. For values greater than N PropInfo returns null. Through it you can obtain a list of the properties supported by the drawing object and some other information about them.
Note that not all the properties you can see in the documentation are described by the PropInfo property. It returns information only for the properties that are best suitable for run-time changes - for example linked to fields in the internal data source. A good example is the Selected property - it is not returned by the PropInfo for any kind of element because it is useful only in interactive mode and makes no sense otherwise.
Name Sets/gets the name of the element
obj.Name = "some name";
v = obj.Name;

It is recommended to keep the element names constant once the label design is complete. For instance when using data to print set of labels, linking the name of an element to a field will change its data linkage once the name is changed. This can be used as a trick, but it will need extreme caution and careful planning.  
Selected Makes the element selected/non-selected in interactive mode.
obj.Selected = value;
issel = obj.Selected;

the property is Boolean.
Makes sense only in interactive editing mode (see Edit object). Most often used by applications/WEB pages that display a list of the elements on the label and allow the user to select an element by clicking its entry in the list. Can be used also for any purpose that requires the application to direct the user's attention to a particular element. 
Locked Changes the locked state of a drawing object (element).
obj.Locked = value;
v = obj.Locked;

the property is Boolean.
This property is used in interactive editing mode (see Edit object). If the VisiLabel.Edit.ProtectLockedElements is set to true then all the locked elements cannot be changed. This allows implementation of visual editing over label design templates where some elements are constant and cannot be changed.
Hidden Changes the visible state of a drawing object (element).
obj.Hidden = value;
v = obj.Hidden;

the property is Boolean. When set to true the element is invisible on the screen and on the printer.
This property is useful in various situations. For example it can be linked to a field in the internal data source to make a particular element visible or invisible depending on the data in the current record.
CodePage Sets/gets the code page as numeric value. The code page is used for all the text translations from UNICODE to ANSI and reverse.
obj.CodePage = value;
cp = obj.CodePage;

By default the system's code page is used. This is usually enough for the most applications, but if you need to place texts in different languages on the label you may need to change the code page of some of the text elements.
Href String. An arbitrary textual value that can be used for a hyperlink if the application that hosts the label desires so.
obj.Href = "../anotherlabel.activelabel"; // points to another label in the parent directory.
vhref = obj.Href;

The Active Label Browser application treats this property as a hyperlink. It is relative to the source location from which the label on which the element resides is loaded. On WEB pages your application may use this property to invoke navigation to another label - i.e. changing the label displayed when the user clicks over certain element on it. However note that on WEB pages all the navigational properties (Src and Dst) are relative to the WEB page's location and not the label load location. See also OnElementClicked event.
Connectivity properties
ObjectState Returns the load state of the object. For the TextLabel element it is always 4 (completed) because it does not support asynchronous load/save operations.
ShowProperties Displays the property sheets of the element giving the user the opportunity to change the element's settings and visual appearance through them.

In interactive editing mode this can be done also by double clicking over an element or by pressing enter for the selected element.





newObjects Copyright 2001-2006 newObjects [ ]