Object Help File

Object Help File

Plugin Name:

Object

Current Version:

1.2.0.0

Description:

A L-OOP model for all standard AMS Visual Object's actions.
L-OOP stands for Lua Object Oriented Programming, for more
information about Object Oriented Programming in Lua, see
this page: Lua Pil :: OOP

This page will not describe how this plugin is written, but mainly
it will describe how a low-level simple L-OOP object has been set up
and called.

Author:

Imagine Programming

Web:

www.imagine-programming.com

E-mail:

contact@imagine-programming.com

Copyright:

© Imagine Programming, 2010.


Table of Contents

Object.Create
Object:Append
Object:SetAppendDelimiter
Object:GetRect
Object:SetRect
Object:Center
Object:CenterRelative
Object:ToggleEnabled
Object:ToggleVisible
Object:Destroy
Object:RestoreOriginalRect
Object:FadeIn
Object:FadeOut
Object.GetPageHandle
Object.GetDialogHandle
Object:ClearContents
Object:SetScript
Object:GetScript
Object:Click
Object:Focus
Object:SetZOrder
Grid.GetCellState, undocumented function.
Properties On The Fly (POTF)

Object.Create


(table) Object.Create ( 

(string) Objectname,

(table) Propertiestable,

(number) Objecttype )

Description

Creates a new L-OOP Object for an AMS visual object.

Note: This method can not be used as method for L-OOP objects

Parameters

Objectname

(string) The object name to create a handle for.

Propertiestable

(table) When the Object given doesn't exist, create it on the fly!

Note: An object type is requried now too!

Objecttype

(number) Objecttype for the to be created object.

CONSTANT

VALUE

DESCRIPTION

OBJECT_BUTTON

0

NA

OBJECT_LABEL

1

NA

OBJECT_PARAGRAPH

2

NA

OBJECT_IMAGE

3

NA

OBJECT_FLASH

4

NA

OBJECT_VIDEO

5

NA

OBJECT_WEB

6

NA

OBJECT_INPUT

7

NA

OBJECT_HOTSPOT

8

NA

OBJECT_LISTBOX

9

NA

OBJECT_COMBOBOX

10

NA

OBJECT_PROGRESS

11

NA

OBJECT_TREE

12

NA

OBJECT_RADIOBUTTON

13

NA

OBJECT_RICHTEXT

14

NA

OBJECT_CHECKBOX

15

NA

OBJECT_SLIDESHOW

16

NA

OBJECT_GRID

17

NA

Returns

(table) This will return a handle/object for the Object class.

With this object, you can preform any action available
in the AMS Object's actionlist.


Example

Input1 = Object:Create("Input1") --it exists, so no properties table and objecttype have to be passed.

Input1:SetText("Hello World!");
Input1:Append("Greets from Imagine Programming!","\r\n");
Input1:Destroy();



Object:Append


Object:Append ( 

(string) Text,

(string) Delimiter )

Description

Append text to the object's text

Parameters

Text

(string) The text to append

Delimiter

(string) The custom delimiter, if you don't use the default one you can set.

Returns

This action dose not return any value.


Example

Input1:Append("This is a string, which will append using the defailt delimiter");
Input1:Append("This string will be appended using a custom delimiter", "\r\n\r\n");



Object:SetAppendDelimiter


Object:SetAppendDelimiter ( 

(string) Delimiter )

Description

Set's the default 'Append' delimiter for Object:Append();

Note: The AppendDelimiter is unique for each object handle!

Parameters

Delimiter

(string) The default delimiter for Object:Append();

Returns

This action dose not return any value.


Example

Input1:SetAppendDelimiter("\r\n\r\n");
Input1:SetText("First line");
Input1:Append("Second line of text using the newly set delimiter");
Input1:Append("Third line of text using only one newrule", "\r\n");



Object:GetRect


(table) Object:GetRect ()

Description

Get the position and size of an object.

Returns

(table) This function will return a table containing the next entrys:

Result.X = Position from the left in pixels
Result.Y = Position from the top in pixels
Result.Width = The width of the object in pixels
Result.Height = The height of the object in pixels


Example

Par1 = Object:Create("Paragraph1");
local oldRect = Par1:GetRect();
oldRect.X = oldRect.X+10;
oldRect.Y = oldRect.Y+10;
Par1:SetRect(oldRect); -- you can also pass the rect as 4 seperate values, see the helpfile on this function.



Object:SetRect


Object:SetRect ( 

(number) Position_X (Or the RectTable),

(number) Position_Y,

(number) Size_Width,

(number) Size_Height )

Description

Set the size and position of an object.

Parameters

Position_X (Or the RectTable)

(number) The position from the left, leave nil for old position.

Note: You can parse a Rect table aswell, {X=0,Y=0,Width=100,Height=200} is an example of a RectTable

Position_Y

(number) The position from the top, leave nil for old position.

Size_Width

(number) The width of the object, leave nil for old size.

Size_Height

(number) The height of the object, leave nil for old size.

Returns

This action dose not return any value.


Example

-- Example 1
Par1 = Object:Create("Paragraph1");
local oldRect = Par1:GetRect();
oldRect.X = oldRect.X+10;
oldRect.Y = oldRect.Y+10;
Par1:SetRect(oldRect); -- you can also pass the rect as 4 seperate values, see the helpfile on this function.

-- Example 2, as from the Par1:SetRect line in first example
Par1:SetRect(oldRect.X+10,oldRect.Y+10,oldRect.Width-10,oldRect.Height-10);

-- Example 3, ignore fields, they stay what they were.
Par1:SetRect(oldRect.X+10,nil,oldRect.Width-10,nil);



Object:Center


Object:Center ( 

(number) Windowhandle = Application.GetWndHandle() )

Description

Center an object on the page.

Parameters

Windowhandle

(number) A valid window handle, the handle of the window this object's on.

Note: This is required, so the object can be centered on the window/dialog.

Returns

This action dose not return any value.


Example

Par1:Center(Application.GetWndHandle());



Object:CenterRelative


Object:CenterRelative ( 

(string) Parent Object )

Description

Center an object onto another object

Parameters

Parent Object

(string) The object to center this object on.

Returns

This action dose not return any value.


Example

Par1:CenterRelative("Paragraph2");



Object:ToggleEnabled


Object:ToggleEnabled ()

Description

Toggles the enabled state for an object

Returns

This action dose not return any value.


Object:ToggleVisible


Object:ToggleVisible ()

Description

Toggles the visible state for an object

Returns

This action dose not return any value.


Object:Destroy


Object:Destroy ( 

(boolean) RemoveObject = false )

Description

Destroys the handle for the object.

Parameters

RemoveObject

(boolean) Removes object from the Page/DialogEx

Returns

This action dose not return any value.


Grid.GetCellState


Grid.GetCellState ( 

(string) Object Name = "",

(number) Row,

(number) Column )

Description

Returns a table containing the state of a cell.

Note: This is also in the Object Action Plugin, Object:GetCellState

Parameters

Object Name

(string) The object name of the grid object.

Row

(number) The row

Column

(number) The column

Returns

This action dose not return any value.


Object:RestoreOriginalRect


Object:RestoreOriginalRect ()

Description

Restores the initial position and size for an object.

Note: This would be the position and size from the time Object:Create was called for this object.

Returns

This action dose not return any value.


Object:FadeIn


(boolean) Object:FadeIn ( 

(number) MaxOpacity = 100,

(number) Timeout = 10 )

Description

A fade-in function for image objects.

Parameters

MaxOpacity

(number) The maximal opacity (<101)

Timeout

(number) The timeout between opacitychange.

Returns

(boolean) Returns true on success.


Example

Image1:FadeIn(100,12);



Object:FadeOut


(boolean) Object:FadeOut ( 

(number) MinOpacity = 0,

(number) Timeout = 10 )

Description

A fade-out function for image objects.

Parameters

MinOpacity

(number) The minimal opacity (>0)

Timeout

(number) The timeout between opacitychange.

Returns

(boolean) Returns true on success.


Example

Image1:FadeOut(20,5);



Object.GetPageHandle


(table) Object.GetPageHandle ()

Description

Get's a new Object handle for managing Page Properties and functions

Returns

(table) The handle to the object


Example

hPage = Object.GetPageHandle();
hPage.Properties.BackgroundColor = Math.HexColorToRGB("00FF00");



Object.GetDialogHandle


(table) Object.GetDialogHandle ()

Description

Get's a new Object handle for managing Dialog Properties and functions

Returns

(table) The handle to the object


Example

hDialog = Object.GetDialogHandle();
hDialog.Properties.BackgroundColor = Math.HexColorToRGB("00FF00");
hDialog.Properties.DialogTitle = "Wooptiedoo!"



Object:ClearContents


Object:ClearContents ()

Description

Removes all items from given object.

Note: In GRID, it only removes all the cells!

Returns

This action dose not return any value.


Example

Input1:ClearContents(); --Clears Input1

Listbox:ClearContents() -- Clears all items in that listbox



Object:SetScript


Object:SetScript ( 

(string) Event,

(string) Script )

Description

Set the script for an event in that object.

Parameters

Event

(string) The name of the event to set the script for

Script

(string) The luascript to place in the event.

Returns

This action dose not return any value.


Example

Button1:SetScript("On Click", [[
Dialog.Message("Hello", "World");
]]);



Object:GetScript


(number) Object:GetScript ( 

(string) Event )

Description

Get the script of a specific event from an object.

Parameters

Event

(string) The name of the event to get the script from

Returns

(number) The luascript as string.


Object:Click


Object:Click ()

Description

Click an object, if supported.

Returns

This action dose not return any value.


Example

Button1:Click(); --Executes the On Click event in the button.



Object:Focus


Object:Focus ()

Description

Set focus to an object

Returns

This action dose not return any value.


Example

Input1:Focus()



Object:SetZOrder


Object:SetZOrder ( 

(number) Position,

(string) ReferenceObject = "" )

Description

Set the z-position of an object.

Parameters

Position

(number) The z-order position.

ReferenceObject

(string) If Position is set to ZORDER_INSERT_BEFORE or ZORDER_INSERT_BEHIND, this is the object that the object specified in ObjectName will be positioned next to. ReferenceObject is an empty string ("") by default.

Returns

This action dose not return any value.



Properties on the fly (POTF)


Description

POTF!

Here you will find some information about the POTF system in the Object Action Plugin.
This system, simply allows you to change properties for an object, without having to call
any functions. As from version 1.2, POTF is also supported for Page and/or DialogEx properties.

You have the handle, and from there on, you change the properties. See the examples to check out
how to do this.

Note: Object.GetPageHandle and Object.GetDialogHandle are important for POTF!

Additional Information

Obtaining Properties

Please note, that for obtaining properties, POTF can not be used just yet.
When you change the properties table for a specific object, you don't actually
'change' it.

Examples

Use it for objects

Image1 = Object.Create("Image1") -- This image must exist on the current page/dialog.
Image1.Properties.ImageFile = "Autoplay\\Images\\Logo.png";
Image1.Properties.Opacity = 0;
Image1.Properties.TooltipText = "Imagine Programming";
-- The properties have been set and applied, no need for calling any functions!
-- But let's just do that, just because fading in images is cool!
Image1:FadeIn(85);
Image1:Destroy(); -- Destroys the handle to the object.

Use it for pages

hPage = Object.GetPageHandle(); -- Can only be called from a page!
hPage.Properties.BackgroundType = BG_SOLID;
hPage.Properties.BackgroundColor = 0;
hPage.Properties.Description = "Page Description";
hPage.Properties.Keywords = {"My", "Page", "Keywords"}; --!Important, you must pass this as one table, you can not
-- edit single fields like hPage.Properties.Keywords[1] = "My";!!
hPage:Destroy(); -- Destroys the handle to the object.

Use it for dialogs

hDialog = Object.GetDialogHandle(); -- Can only be called from an opened dialog!
hDialog.Properties.DialogTitle = "This is the new title!";
hDialog.Properties.BackgroundType = BG_GRADIENT;
hDialog.Properties.GradientColorTop = Math.HexColorToNumber("BB0000");
hDialog.Properties.BackgroundColor = Math.HexColorToNumber("450000");
hDialog.Properties.Resizable = false;
hDialog:Destroy() -- Destroys the handle to the object. -- Go check it out!



© Imagine Programming, 2010.
This File Was Mostly Generated With AMS ActionFile Editor