Libraries.Interface.Item Documentation

The Item class represents any object that has a position (such as x and y coordinates) and dimensions (e.g. width and height). Note that because Item contains blueprint actions, it can't be used directly. Users should use classes that inherit from Item, such as Item2D, Item3D, Drawable, or Model.

Inherits from: Libraries.Language.Object

Summary

Variable Summary Table

VariablesDescription
integer LIST_ITEM
integer TREE_TABLE_CELL
integer BUTTON
integer TEXT_FIELD
integer TOOLBAR
integer MENU_BAR
integer TREE_TABLE
integer CHECKBOX
integer TAB_PANE
integer TOGGLE_BUTTON
integer NOT_ACCESSIBLEThe not accessible flag indicates that the accessibility system should ignore this item. Any item can override it, but it is the default to prevent flooding the system with a great deal of UI helper classe
integer MENU_ITEM
integer PANE
integer CUSTOM
integer TEXTBOX
integer LIST
integer DIALOG
integer TAB
integer GROUP
integer TABLE
integer ITEMThe not accessible flag indicates that the accessibility system should ignore this item. Any item can override it, but it is the default to prevent flooding the system with a great deal of UI helper classe
integer RADIO_BUTTON
integer PROGRESS_BAR
integer TREE_ITEM
integer TREE
integer CELL
integer POPUP_MENU

Actions Summary Table

ActionsDescription
AddBehavior(Libraries.Interface.Behaviors.Behavior behavior)This action adds a new Behavior to this Ite
AddFocusListener(Libraries.Interface.Events.FocusListener listener)This action adds a FocusListener to the Item.
AddMouseListener(Libraries.Interface.Events.MouseListener listener)This action adds a MouseListener to the Item.
AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)This action adds a MouseMovementListener to the Item.
AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)This action adds a MouseWheelListener to the Item.
AddTouchListener(Libraries.Interface.Events.TouchListener listener)This action adds a TouchListener to the Item.
BeginCollision(Libraries.Interface.Item item)This action is used to indicate that two items have just begun colliding.
CancelBehaviors()This action stops all behaviors this Item is following without finishing the
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Dispose()This action is used to free up any additional memory that is being used by this Item for purposes such as graphics.
DisposeAll()This action is used to call Dispose on this Item and on the entire children hierarchy of this Ite
DisposeChildren()This action is used to call Dispose on the entire children hierarchy of this Item.
Empty()This action will remove all Items from this Item's children hierarchy.
EmptyAll()This action will call Empty on the entire children hierarchy of this item, and then empty this item as wel
EmptyChildren()This action is used to call Empty on all children contained in this item's children hierarchy.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
FinishCollision(Libraries.Interface.Item item)This action is used to indicate that two items that were previously colliding no longer are.
Focus()This action sets focus on this Item.
GainedFocus(Libraries.Interface.Events.FocusEvent event)This action is fired if the item received the focu
GetAccessibilityCode()This action returns the current accessiblity code for this It
GetAccessibilityType()This action returns the name of the accessiblity code for this Item as Te
GetAccessibleParent()This action returns the nearest parent object that is accessible.
GetDescription()This action returns the current internal description of the Item.
GetFocusListeners()This action returns an Iterator containing all of the FocusListeners that have been added to this Item using the AddFocusListener action.
GetGlobalX()This action returns the Item's global x coordinate.
GetGlobalY()This action returns the Item's global y coordinate.
GetGlobalZ()This action returns the Item's global z coordinate.
GetHashCode()This action gets the hash code for an object.
GetInputGroup()This action returns the input group for this Item.
GetInputTable()
GetItemCount()This action will return the total number of children this Item ha
GetMouseListeners()This action returns an Iterator containing all of the MouseListeners that have been added to this Item using the AddMouseListener action.
GetMouseMovementListeners()This action returns an Iterator containing all of the MouseMovementListeners that have been added to this Item using the AddMouseMovementListener action.
GetMouseWheelListeners()This action returns an Iterator containing all of the MouseWheelListeners that have been added to this Item using the AddMouseWheelListener action.
GetName()This action returns the current internal name of the Item.
GetNextFocus()This action returns the next focus item.
GetPreviousFocus()This action returns the previous focus item.
GetPropertiesSize()
GetProperty(text key)
GetPropertyKeyIterator()
GetTouchListeners()This action returns an Iterator containing all of the TouchListeners that have been added to this Item using the AddTouchListener action.
GetX()This action returns the currently set X coordinate of the Item.
GetY()This action returns the currently set Y coordinate of the Item.
GetZ()This action returns the currently set Z coordinate of the Item.
HasProperties()
HasProperty(text key)
Hide()This action is used to indicate that an Item and all Items that were added to it should not be visible on the screen.
IsAcceptingMouseInput()This action returns whether or not this Item accepts mouse input.
IsAccessibleParent()This action returns the nearest parent object that is accessible.
IsFocusable()This action returns whether or not the Item can currently receive focus.
IsFocused()The IsFocused action determines if this Item is currently focused, returning true if it is, or false if it is no
IsShowing()This action returns whether the Item is currently set to be visible on the screen.
LostFocus(Libraries.Interface.Events.FocusEvent event)This action is fired if the item lost the focu
MoveX(number xAmount)This action will increase the x-coordinate of this Item by the given amount.
MoveY(number yAmount)This action will increase the y-coordinate of this Item by the given amount.
MoveZ(number zAmount)This action will increase the z-coordinate of this Item by the given amount.
ProcessMouseEvent(Libraries.Interface.Events.MouseEvent event)This action takes a mouse event and handles it.
ProcessTouchEvent(Libraries.Interface.Events.TouchEvent event)This action takes a touch event and handles it.
RemoveFocusListener(Libraries.Interface.Events.FocusListener listener)This action removes a FocusListener from the Item.
RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)This action removes a MouseListener from the Item.
RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)This action removes a MouseMovementListener from the Item.
RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)This action removes a MouseWheelListener from the Item.
RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)This action removes a TouchListener from the Item.
SetAcceptsMouseInput(boolean accepts)This action sets whether or not this Item accepts mouse input.
SetAccessibilityCode(integer newAccessibilityCode)This action changes the accessibility code for this Item.
SetDescription(text newDescription)This action sets the internal description of the Item.
SetFocusable(boolean focus)The SetFocusable action sets whether or not this Item should be focusable.
SetInputGroup(text group)This action sets the input group for this Item.
SetName(text newName)This action sets the internal name of the Item.
SetNextFocus(Libraries.Interface.Item next)This action sets the next focus item.
SetPosition(number newX, number newY, number newZ)This action will set both the X, Y, and Z coordinates of the Item, in that order.
SetPreviousFocus(Libraries.Interface.Item previous)This action sets the previous focus item.
SetProperty(text key, Libraries.Data.Formats.JavaScriptObjectNotation value)
SetX(number setX)This action sets the X coordinate of the Item.
SetY(number setY)This action sets the Y coordinate of the Item.
SetZ(number setZ)This action sets the Z coordinate of the Item.
Show()This action is used to indicate that an Item and all Items that were added to it should be visible on the screen.
Update(number secondsSinceUpdate)This action updates the item.
UpdateAll(number secondsSinceUpdate)This action calls the Update action on this Item and all Items that have been added to this item with the Add action.

Actions Documentation

AddBehavior(Libraries.Interface.Behaviors.Behavior behavior)

This action adds a new Behavior to this Ite

Parameters

AddFocusListener(Libraries.Interface.Events.FocusListener listener)

This action adds a FocusListener to the Item. When the Item receives a FocusEvent due to either gaining or losing the focus, the listener will be notified.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.FocusListener
        Item myItem
        FocusListener listener
        myItem:AddFocusListener(listene

Parameters

AddMouseListener(Libraries.Interface.Events.MouseListener listener)

This action adds a MouseListener to the Item. If the Item ever receives a MouseEvent due to a mouse click, the mouse listener will be notified.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseListener
        Item myItem
        MouseListener listener
        myItem:AddMouseListener(listene

Parameters

AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)

This action adds a MouseMovementListener to the Item. If the Item ever receives a MouseEvent due to mouse movement, the listener will be notified.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseMovementListener
        Item myItem
        MouseMovementListener listener
        myItem:AddMouseMovementListener(listene

Parameters

AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)

This action adds a MouseWheelListener to the Item. If the Item ever receives a MouseEvent due to the mouse wheel being scrolled, the listener will be notified.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseWheelListener
        Item myItem
        MouseWheelListener listener
        myItem:AddMouseWheelListener(listene

Parameters

AddTouchListener(Libraries.Interface.Events.TouchListener listener)

This action adds a TouchListener to the Item. If the Item ever receives a TouchEvent, the listener will be notified.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.TouchListener
        Item myItem
        TouchListener listener
        myItem:AddTouchListener(listene

Parameters

BeginCollision(Libraries.Interface.Item item)

This action is used to indicate that two items have just begun colliding. When two Items collide, the BeginCollision action should be called on both of them, with the other item passed as a parameter to the action. Note that this action does nothing by default, but classes that inherit from Item may override it.

Example Code

use Libraries.Interface.Item

        Item collider1
        Item collider2
        collider1:BeginCollision(collider2)
        collider2:BeginCollision(collider

Parameters

CancelBehaviors()

This action stops all behaviors this Item is following without finishing the

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smalle

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Dispose()

This action is used to free up any additional memory that is being used by this Item for purposes such as graphics. Note that the Item class doesn't have any extra memory that needs to be released with this action, but some classes which inherit from Item, such as Libraries.Game.Graphics.Drawable, d

DisposeAll()

This action is used to call Dispose on this Item and on the entire children hierarchy of this Ite

DisposeChildren()

This action is used to call Dispose on the entire children hierarchy of this Item. This will not call Dispose on this Ite

Empty()

This action will remove all Items from this Item's children hierarchy. Note that this will not empty the hierarchies of the contained Items.

Example Code

use Libraries.Interface.Item

        Item parentItem
        Item child1
        Item child2
        Item grandchild
        parentItem:Add(child1)
        parentItem:Add(child2)
        child1:Add(grandChild)
        parentItem:Empty

EmptyAll()

This action will call Empty on the entire children hierarchy of this item, and then empty this item as wel

EmptyChildren()

This action is used to call Empty on all children contained in this item's children hierarchy. This will not empty the children of this ite

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

FinishCollision(Libraries.Interface.Item item)

This action is used to indicate that two items that were previously colliding no longer are. The FinishCollision action should be called on both Items involved, with the other item passed as a parameter to the action. Note that this action does nothing by default, but classes that inherit from Item may override it.

Example Code

use Libraries.Interface.Item

        Item collider1
        Item collider2
        collider1:FinishCollision(collider2)
        collider2:FinishCollision(collider

Parameters

Focus()

This action sets focus on this Item. If the Item is not focusable, it will instead look through the parent hierarchy and set focus on the first focusable ancestor. If no focusable Item can be found, this action will have no effec

GainedFocus(Libraries.Interface.Events.FocusEvent event)

This action is fired if the item received the focu

Parameters

GetAccessibilityCode()

This action returns the current accessiblity code for this It

Return

integer:

GetAccessibilityType()

This action returns the name of the accessiblity code for this Item as Te

Return

text:

GetAccessibleParent()

This action returns the nearest parent object that is accessible. This can be anything that the programmer wants to be accessible, from user interface components in a 2D interface to 3D components relative in 3-space on screen. By default, items have no accessible parent and are self-contained, but user interface components normally override the behavior so that controls can be logically nested within each other. attribute: returns It

Return

Libraries.Interface.Item:

GetDescription()

This action returns the current internal description of the Item.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetDescription("Used for demo purposes.")
        output "My item's description is : " + item:GetDescription

Return

text:

GetFocusListeners()

This action returns an Iterator containing all of the FocusListeners that have been added to this Item using the AddFocusListener action.

Return

Libraries.Containers.Iterator: An iterator containing all of the registered FocusListener

GetGlobalX()

This action returns the Item's global x coordinate. This is the actual world coordinate that the item exists at after it has been offset by its parent's position. If this Item doesn't have a parent, and the offset hasn't been set manually, this is the same as GetX().

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffsetX(100)
        myItem:SetX(30)
        number globalX = myItem:GetGlobalX

Return

number:

GetGlobalY()

This action returns the Item's global y coordinate. This is the actual world coordinate that the item exists at after it has been offset by its parent's position. If this Item doesn't have a parent, and the offset hasn't been set manually, this is the same as GetY().

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffsetY(60)
        myItem:SetX(90)
        number globalY = myItem:GetGlobalY

Return

number:

GetGlobalZ()

This action returns the Item's global z coordinate. This is the actual world coordinate that the item exists at after it has been offset by its parent's position. If this Item doesn't have a parent, and the offset hasn't been set manually, this is the same as GetZ().

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        myItem:SetOffsetZ(40)
        myItem:SetX(50)
        number globalZ = myItem:GetGlobalZ

Return

number:

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode

Return

integer: The integer hash code of the object.

GetInputGroup()

This action returns the input group for this Item. When used with the Game libraries, this tag describes what InputTable (if any) can interact with this Item due to input.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetInputGroup("arrowKeys")
        output "My item's input group is : " + item:GetInputGroup

Return

text: The input group tag being used by this Item.

GetInputTable()

Return

Libraries.Game.InputTable:

GetItemCount()

This action will return the total number of children this Item ha

Return

integer:

GetMouseListeners()

This action returns an Iterator containing all of the MouseListeners that have been added to this Item using the AddMouseListener action.

Return

Libraries.Containers.Iterator: An iterator containing all of the registered MouseListener

GetMouseMovementListeners()

This action returns an Iterator containing all of the MouseMovementListeners that have been added to this Item using the AddMouseMovementListener action.

Return

Libraries.Containers.Iterator: An iterator containing all of the registered MouseMovementListener

GetMouseWheelListeners()

This action returns an Iterator containing all of the MouseWheelListeners that have been added to this Item using the AddMouseWheelListener action.

Return

Libraries.Containers.Iterator: An iterator containing all of the registered MouseWheelListener

GetName()

This action returns the current internal name of the Item.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetName("My Item")
        output "My item's name is " + item:GetName

Return

text:

GetNextFocus()

This action returns the next focus item. When this Item has the focus and the user requests the focus to advance (e.g. by pressing the tab key), the returned value is the next item to receive that focus, if it is defined. If it isn't defined, the focus can not advance from this Item.

Return

Libraries.Interface.Item: The next Item to receive focus after this on

GetPreviousFocus()

This action returns the previous focus item. When this Item has the focus and the user requests the focus to move backwards (e.g. by pressing shift & tab), the returned value is the previous item to receive that focus, if it is defined. If it isn't defined, the focus can not move backwards from this Item.

Return

Libraries.Interface.Item: The previous Item to receive focus before this on

GetPropertiesSize()

Return

integer

GetProperty(text key)

Parameters

Return

Libraries.Data.Formats.JavaScriptObjectNotation

GetPropertyKeyIterator()

Return

Libraries.Containers.Iterator

GetTouchListeners()

This action returns an Iterator containing all of the TouchListeners that have been added to this Item using the AddTouchListener action.

Return

Libraries.Containers.Iterator: An iterator containing all of the registered TouchListener

GetX()

This action returns the currently set X coordinate of the Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        number value = myItem:GetX

Return

number:

GetY()

This action returns the currently set Y coordinate of the Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        number value = myItem:GetY

Return

number:

GetZ()

This action returns the currently set Z coordinate of the Item.

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        number value = myItem:GetZ

Return

number:

HasProperties()

Return

boolean

HasProperty(text key)

Parameters

Return

boolean

Hide()

This action is used to indicate that an Item and all Items that were added to it should not be visible on the screen. Note that the Item class on its own cannot be drawn on the screen, but classes that inherit from it such as Libraries.Game.Graphics.Drawable can be. By default, Items are considered visible.

Example Code

use Libraries.Interface.Item

        Item item
        item:Hide

IsAcceptingMouseInput()

This action returns whether or not this Item accepts mouse input. If the value is true, this will intercept incoming mouse events, triggering any related MouseListeners and InputSets and preventing the mouse event from propagating to other Items on the Layer. The default value is true.

Return

boolean: True if this Item can receive mouse events, or false otherwis

IsAccessibleParent()

This action returns the nearest parent object that is accessible. This can be anything that the programmer wants to be accessible, from user interface components in a 2D interface to 3D components relative in 3-space on screen. By default, items have no accessible parent and are self-contained, but user interface components normally override the behavior so that controls can be logically nested within each other. attribute: returns It

Return

boolean:

IsFocusable()

This action returns whether or not the Item can currently receive focus. This property can be set with SetFocusable(

Return

boolean:

IsFocused()

The IsFocused action determines if this Item is currently focused, returning true if it is, or false if it is no

Return

boolean:

IsShowing()

This action returns whether the Item is currently set to be visible on the screen.

Example Code

use Libraries.Interface.Item

        Item item
        item:Hide()
        boolean visible = item:IsShowing

Return

boolean: A boolean representing whether or not the Item is currently visible.

LostFocus(Libraries.Interface.Events.FocusEvent event)

This action is fired if the item lost the focu

Parameters

MoveX(number xAmount)

This action will increase the x-coordinate of this Item by the given amount.

Example Code

use Libraries.Interface.Item

        Item myItem
        myItem:SetX(50)
        myItem:MoveX(2

Parameters

MoveY(number yAmount)

This action will increase the y-coordinate of this Item by the given amount.

Example Code

use Libraries.Interface.Item2D

        Item2D myItem
        myItem:SetY(50)
        myItem:MoveY(2

Parameters

MoveZ(number zAmount)

This action will increase the z-coordinate of this Item by the given amount.

Example Code

use Libraries.Interface.Item3D

        Item3D myItem
        myItem:SetZ(50)
        myItem:MoveZ(2

Parameters

ProcessMouseEvent(Libraries.Interface.Events.MouseEvent event)

This action takes a mouse event and handles it. It will first test to see if the mouse event took place within the bounds of this Item. If so, it will notify any MouseListeners of the event. If the event was not contained within this Item, or if there are no MouseListeners on this Item, the Item will ask its parent Item to process the mouse event, if there is a parent.

Example Code

use Libraries.Interface.Item2D
        use Libraries.Interface.Events.MouseEvent
        use Libraries.Interface.Events.MouseListener
        Item2D myItem
        MouseListener listener
        myItem:AddMouseListener(listener)
        MouseEvent event
        event:eventType = event:CLICKED_MOUSE
        myItem:ProcessMouseEvent(even

Parameters

ProcessTouchEvent(Libraries.Interface.Events.TouchEvent event)

This action takes a touch event and handles it. It will first test to see if the touch event took place within the bounds of this Item. If so, it will notify any TouchListeners of the event. If the event was not contained within this Item, or if there are no TouchListeners on this Item, the Item will ask its parent Item to process the touch event, if there is a parent.

Example Code

use Libraries.Interface.Item2D
        use Libraries.Interface.Events.TouchEvent
        use Libraries.Interface.Events.TouchListener
        Item2D myItem
        TouchListener listener
        myItem:AddTouchListener(listener)
        TouchEvent event
        event:eventType = event:BEGAN
        myItem:ProcessTouchEvent(even

Parameters

RemoveFocusListener(Libraries.Interface.Events.FocusListener listener)

This action removes a FocusListener from the Item. The listener will no longer receive notification if the Item gets a FocusEvent.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.FocusListener
        Item myItem
        FocusListener listener
        myItem:AddFocusListener(listener)
        myItem:RemoveFocusListener(listene

Parameters

RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)

This action removes a MouseListener from the Item. The listener will no longer receive notification if the Item gets a mouse click event.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseListener
        Item myItem
        MouseListener listener
        myItem:AddMouseListener(listener)
        myItem:RemoveMouseListener(listene

Parameters

RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)

This action removes a MouseMovementListener from the Item. The listener will no longer receive notification if the Item gets a mouse movement event.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseMovementListener
        Item myItem
        MouseMovementListener listener
        myItem:AddMouseMovementListener(listener)
        myItem:RemoveMouseMovementListener(listene

Parameters

RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)

This action removes a MouseWheelListener from the Item. The listener will no longer receive notification if the Item gets a mouse wheel event.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseWheelListener
        Item myItem
        MouseWheelListener listener
        myItem:AddMouseWheelListener(listener)
        myItem:RemoveMouseWheelListener(listene

Parameters

RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)

This action removes a TouchListener from the Item. The listener will no longer receive notification if the Item gets a TouchEvent.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.TouchListener
        Item myItem
        TouchListener listener
        myItem:AddTouchListener(listener)
        myItem:RemoveTouchListener(listene

Parameters

SetAcceptsMouseInput(boolean accepts)

This action sets whether or not this Item accepts mouse input. If set to true, this will intercept incoming mouse events, triggering any related MouseListeners and InputSets and preventing the mouse event from propagating to other Items on the Layer. The default value is true.

Parameters

SetAccessibilityCode(integer newAccessibilityCode)

This action changes the accessibility code for this Item. This should be done with care because setting the accessiblity code to the incorrect type can cause accessibility to stop functioning or, in some cases, cause the program to crash.

Parameters

SetDescription(text newDescription)

This action sets the internal description of the Item.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetDescription("Used for demo purposes.

Parameters

SetFocusable(boolean focus)

The SetFocusable action sets whether or not this Item should be focusable. If the Item is currently focused and made unfocusable, then it will lose focus, and there will be no focused elemen

Parameters

SetInputGroup(text group)

This action sets the input group for this Item. When used with the Game libraries, this tag describes what InputTable (if any) can interact with this Item due to input.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetInputGroup("arrowKeys")
        output "My item's input group is : " + item:GetInputGroup

Parameters

SetName(text newName)

This action sets the internal name of the Item.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetName("My Item

Parameters

SetNextFocus(Libraries.Interface.Item next)

This action sets the next focus item. When this Item has the focus and the user requests the focus to advance (e.g. by pressing the tab key), the focus will move to the next focus item, if it is defined.

Parameters

SetPosition(number newX, number newY, number newZ)

This action will set both the X, Y, and Z coordinates of the Item, in that order.

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        myItem:SetPosition(30, 70, 4

Parameters

SetPreviousFocus(Libraries.Interface.Item previous)

This action sets the previous focus item. When this Item has the focus and the user requests the focus to move backwards (e.g. by pressing shift & tab), the focus will move to the previous focus item, if it is defined.

Parameters

SetProperty(text key, Libraries.Data.Formats.JavaScriptObjectNotation value)

Parameters

SetX(number setX)

This action sets the X coordinate of the Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetX(35.

Parameters

SetY(number setY)

This action sets the Y coordinate of the Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetY(210.

Parameters

SetZ(number setZ)

This action sets the Z coordinate of the Item.

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        myItem:SetZ(180.

Parameters

Show()

This action is used to indicate that an Item and all Items that were added to it should be visible on the screen. Note that the Item class on its own cannot be drawn on the screen, but classes that inherit from it such as Libraries.Game.Graphics.Drawable can be. By default, Items are considered visible.

Example Code

use Libraries.Interface.Item

        Item item
        item:Show

Update(number secondsSinceUpdate)

This action updates the item. It takes a number parameter that should indicate how many seconds have passed since the last time this action was called. This action does nothing in the Item class, but any class that inherits from Item may override it.

Example Code

use Libraries.Interface.Item
        use Libraries.System.DateTime
        
        class Main is Item

            action Main
                // We'll use a DateTime object to count seconds.
                DateTime time
                number currentTime = time:GetEpochTime()
                number newTime = 0

                repeat while GetX() < 300
                    // Check what the time is now.
                    newTime = time:GetEpochTime()

                    // Calculate how many seconds have passed, then call Update.
                    Update( (newTime - currentTime)/1000 )

                    // Store the old time.
                    currentTime = newTime
                end
            end

            // Our update action will move our Item to the right at 200 units a second.
            action Update(number secondsSinceUpdate)
                SetX(GetX() + 200 * secondsSinceUpdate)
            end
        e

Parameters

UpdateAll(number secondsSinceUpdate)

This action calls the Update action on this Item and all Items that have been added to this item with the Add action.

Example Code

use Libraries.Interface.Item
        
        Item parentItem
        Item child1
        Item child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        parentItem:UpdateAll(

Parameters