The figure below displays the Active Label's object model. The connecting
lines show the relation between the internal objects - the arrows point
from the parent (container) to the child (contained) object. Following
the arrows you can easily find out how to reach certain object type
starting from the root object (VisiLabel object). You can also click
over each object to go to its page in this documentation. See more
details after the figure.
When the object is created or obtained (in a WEB page for example) by
your code it receives a reference to the root object - VisiLabel object.
From here the code can access the other objects through the properties
and the methods of that object. Example: Any Javascript in a WEB
page that embeds an Active Label ActiveX like this:
<OBJECT ID="VisiLabel1" CLASSID="CLSID:09A02CEE-410B-47BA-A837-E62C9C8D70BF">
... some parameters ...
</OBJECT> // Few example lines that show how to interact
with various internal objects
x = VisiLabel1.Page.LeftMargin;
// obtains the page left margin
x = VisiLabel1("My TextLabel").Text;
// Obtains the text of the graphical object named "My Text
Label"
VisiLabel1.Variables.Field("My
Field").Value = "Some
text"; // Sets a field value in the internal data source
VisiLabel1.Variables("My
Field") = "Some text"; // A short form of the
previous
VisiLabel1.Edit.ShowElementProperties(5);
// Invokes the property sheet dialog for the 5-th graphical object
VisiLabel1.Edit.ShowElementProperties("My
Object"); // Invokes the property sheet dialog for the
graphical object named "My Object"
You can save references to the internal objects in variables and thus
use shorter expressions when interacting with them. If the variable
refers to an object that is deleted or otherwise invalidated, you will
receive an "invalid object" error if the operation you attempt
over the object requires it to be valid. Example: Any Javascript in a
WEB page that embeds a VisiLabel like this:
<OBJECT ID="VisiLabel1" CLASSID="CLSID:09A02CEE-410B-47BA-A837-E62C9C8D70BF">
... some parameters ...
</OBJECT> // Few example lines that show how to interact with
various internal objects
var myTextLabel = VisiLabel1("My Text Label");
// saves reference to the text label object in the variable
myTextLabel.FontFace =
"Tahoma"; // Changes the font used by the text label to
Tahoma
VisiLabel1.RemoveElement("My
Text Label"); // Removes the specified graphical object
myTextLabel.FontSize =
500; // Attempt to change the font size. Will cause script error
because the object has been removed. Although deleted the object will
exist in memory as long as you keep variable(s) referring to it, but
it will not display on the screen nor it would allow you to do
anything useful with it.
If you use the Active Label in another environment - C++ program, VB
program or another COM enabled application the code syntax will look as
the particular programming language requires, but the way you access the
internal objects remains the same.
|