Welcome
Object
1.2.0.0
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.
Imagine Programming
www.imagine-programming.com
contact@imagine-programming.com
© Imagine Programming, 2010.
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)
(table) Object.Create ( |
(string) Objectname, (table) Propertiestable, (number) Objecttype ) |
Creates a new L-OOP Object for an AMS visual object.
Note: This method can not be used as method for L-OOP objects
(string) The object name to create a handle for.
(table) When the Object given doesn't exist, create it on the fly!
Note: An object type is requried now too!
(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 |
(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.
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 ( | (string) Text, (string) Delimiter ) |
Append text to the object's text
(string) The text to append
(string) The custom delimiter, if you don't use the default one you can set.
This action dose not return any value.
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 ( | (string) Delimiter ) |
Set's the default 'Append' delimiter for Object:Append();
Note: The AppendDelimiter is unique for each object handle!
(string) The default delimiter for Object:Append();
This action dose not return any value.
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");
(table) Object:GetRect () |
Get the position and size of an object.
(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
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 ( | (number) Position_X (Or the RectTable), (number) Position_Y, (number) Size_Width, (number) Size_Height ) |
Set the size and position of an object.
(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
(number) The position from the top, leave nil for old position.
(number) The width of the object, leave nil for old size.
(number) The height of the object, leave nil for old size.
This action dose not return any value.
-- 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 ( | (number) Windowhandle = Application.GetWndHandle() ) |
Center an object on the page.
(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.
This action dose not return any value.
Par1:Center(Application.GetWndHandle());
Object:CenterRelative ( | (string) Parent Object ) |
Center an object onto another object
(string) The object to center this object on.
This action dose not return any value.
Par1:CenterRelative("Paragraph2");
Object:ToggleEnabled () |
Toggles the enabled state for an object
This action dose not return any value.
Object:ToggleVisible () |
Toggles the visible state for an object
This action dose not return any value.
Object:Destroy ( | (boolean) RemoveObject = false ) |
Destroys the handle for the object.
(boolean) Removes object from the Page/DialogEx
This action dose not return any value.
Grid.GetCellState ( | (string) Object Name = "", (number) Row, (number) Column ) |
Returns a table containing the state of a cell.
Note: This is also in the Object Action Plugin, Object:GetCellState
(string) The object name of the grid object.
(number) The row
(number) The column
This action dose not return any value.
Object:RestoreOriginalRect () |
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.
This action dose not return any value.
(boolean) Object:FadeIn ( | (number) MaxOpacity = 100, (number) Timeout = 10 ) |
A fade-in function for image objects.
(number) The maximal opacity (<101)
(number) The timeout between opacitychange.
(boolean) Returns true on success.
Image1:FadeIn(100,12);
(boolean) Object:FadeOut ( | (number) MinOpacity = 0, (number) Timeout = 10 ) |
A fade-out function for image objects.
(number) The minimal opacity (>0)
(number) The timeout between opacitychange.
(boolean) Returns true on success.
Image1:FadeOut(20,5);
(table) Object.GetPageHandle () |
Get's a new Object handle for managing Page Properties and functions
(table) The handle to the object
hPage = Object.GetPageHandle();
hPage.Properties.BackgroundColor = Math.HexColorToRGB("00FF00");
(table) Object.GetDialogHandle () |
Get's a new Object handle for managing Dialog Properties and functions
(table) The handle to the object
hDialog = Object.GetDialogHandle();
hDialog.Properties.BackgroundColor = Math.HexColorToRGB("00FF00");
hDialog.Properties.DialogTitle = "Wooptiedoo!"
Object:ClearContents () |
Removes all items from given object.
Note: In GRID, it only removes all the cells!
This action dose not return any value.
Input1:ClearContents(); --Clears Input1
Listbox:ClearContents() -- Clears all items in that listbox
Object:SetScript ( | (string) Event, (string) Script ) |
Set the script for an event in that object.
(string) The name of the event to set the script for
(string) The luascript to place in the event.
This action dose not return any value.
Button1:SetScript("On Click", [[
Dialog.Message("Hello", "World");
]]);
(number) Object:GetScript ( | (string) Event ) |
Get the script of a specific event from an object.
(string) The name of the event to get the script from
(number) The luascript as string.
Object:Click () |
Click an object, if supported.
This action dose not return any value.
Button1:Click(); --Executes the On Click event in the button.
Object:Focus () |
Set focus to an object
This action dose not return any value.
Input1:Focus()
Object:SetZOrder ( | (number) Position, (string) ReferenceObject = "" ) |
Set the z-position of an object.
(number) The z-order position.
(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.
This action dose not return any value.
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!
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.
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.
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.
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