Page.CreateObject

Page.CreateObject ( 

number ObjectType,

string ObjectName,

table  Properties )

Example 1

-- Initialize the properties table
tWebProperties = {}
tWebProperties.URL="http://www.amsuser.com";
tWebProperties.Enabled=true;
tWebProperties.Visible=true;
tWebProperties.X=0;
tWebProperties.Y=0;
tWebProperties.Width=630;
tWebProperties.Height=425;

-- Create the web object
Page.CreateObject(OBJECT_WEB, "AC_Web_Created_By_Action", tWebProperties);

Initializes a table of properties for a web object, and then creates the web object "AC_Web_Created_By_Actions" based on these properties. The first three characters in the name ("AC_") were added to differentiate this object from objects on the page from design-time (AC_ denotes an 'action created' object). This type of object naming is not required, but it helps to ensure you don't try to create an already created object.

Example 2

-- Initialize the properties table
tImageProperties = {};
tImageProperties.ImageFile = _SourceFolder .. "\\AutoPlay\\Images\\Create_Me.jpg";
tImageProperties.UseTransColor = false;
tImageProperties.Opacity = 75;
tImageProperties.HitTest = HITTEST_STANDARD;
tImageProperties.Enabled = true;
tImageProperties.Visible = true;
tImageProperties.X = 50;
tImageProperties.Y = 50;
tImageProperties.Width = 100;
tImageProperties.Height = 200;
tImageProperties.TooltipText = "I was created by an action!!";
tImageProperties.Cursor = CURSOR_MEDIA;
tImageProperties.HighlightSound = SND_STANDARD;
tImageProperties.ClickSound = SND_STANDARD;

-- Create the image object
Page.CreateObject(OBJECT_IMAGE, "AC_Image_Object", tImageProperties);

Initializes a table of properties for an image object, and then creates the image object "Image_Object" based on these properties.

See also:  Related Actions