Libraries.Interface.Controls.Scenes.Items.EditorItem Documentation
The Editor Item class represents an object in the Scene Editor that is in the scene and is being added, removed, or having its properties modified. The main purpose of this class is to get and set information about certain properties of an item in the scene such as those for physics calculations like mass and restitution. Properties relating to physics and others important to the scene like position and the texture of the object will be saved to the scene file.
Inherits from: Libraries.Interface.Item, Libraries.Language.Object
Actions Documentation
AddBehavior(Libraries.Interface.Behaviors.Behavior behavior)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.FocusListener
Item myItem
FocusListener listener
myItem:AddFocusListener(listener)
AddGestureListener(Libraries.Interface.Events.GestureListener listener)
This action adds a GestureListener to the Item. If the Item ever receives a GestureEvent, the listener will be notified.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.GestureListener
Item myItem
GestureListener listener
myItem:AddGestureListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseListener
Item myItem
MouseListener listener
myItem:AddMouseListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseMovementListener
Item myItem
MouseMovementListener listener
myItem:AddMouseMovementListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseWheelListener
Item myItem
MouseWheelListener listener
myItem:AddMouseWheelListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.TouchListener
Item myItem
TouchListener listener
myItem:AddTouchListener(listener)
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.
Parameters
- Libraries.Interface.Item: The other Item involved in the collision.
Example
use Libraries.Interface.Item
Item collider1
Item collider2
collider1:BeginCollision(collider2)
collider2:BeginCollision(collider1)
CancelBehaviors()
This action stops all behaviors this Item is following without finishing them.
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.
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Example
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
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, do.
DisposeAll()
This action is used to call Dispose on this Item and on the entire children hierarchy of this Item.
DisposeChildren()
This action is used to call Dispose on the entire children hierarchy of this Item. This will not call Dispose on this Item.
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
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 well.
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 item.
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
Example
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
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.
Parameters
- Libraries.Interface.Item: The other Item involved in the collision.
Example
use Libraries.Interface.Item
Item collider1
Item collider2
collider1:FinishCollision(collider2)
collider2:FinishCollision(collider1)
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 effect.
GainedFocus(Libraries.Interface.Events.FocusEvent event)
Internal action so that when an object in the editor gains focus it also tells the SceneEditor class that this is the item that currently has the selection.
Parameters
GainedSelection()
Internal action so that when an object in the editor gains focus it also tells the SceneEditor class that this is the item that currently has the selection.
GetAccessibilityCode()
This action returns the current accessiblity code for this Item
Return
integer:
GetAccessibilityRoleDescription()
This action returns the custom accessibility role description for this item, if any.
Return
text:
GetAccessibilityType()
This action returns the name of the accessiblity code for this Item as Text
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 Item
Return
GetChildAsItem(integer index)
This action is used to retrieve the children of this Item as Items. This makes it possible to retrieve or iterate over the children without having to perform casting.
Parameters
- integer index: The index of the child to retrieve from the child array.
Return
Libraries.Interface.Item: The child item at the given index.
Example
use Libraries.Interface.Item
Item parentItem
Item child1
child1:SetName("First")
parentItem:Add(child1)
Item child2
child2:SetName("Second")
parentItem:Add(child2)
Item child3
child3:SetName("Third")
parentItem:Add(child3)
integer counter = 0
repeat while counter < item:GetItemCount()
Item child = parentItem:GetChildAsItem(counter)
output child:GetName()
counter = counter + 1
end
GetConstants()
Used Internally. This action returns the class that contains all the constants used by this object.
Return
GetDescription()
This action returns the current internal description of the Item.
Return
text:
Example
use Libraries.Interface.Item
Item item
item:SetDescription("Used for demo purposes.")
output "My item's description is : " + item:GetDescription()
GetEditorFriction()
This action gets the coefficient of friction that is stored inside this editor property holder.
Return
number: the coefficient of friction.
GetEditorMass()
This action returns the mass of the object set in the editor in kilograms.
Return
number: the mass of the object.
GetEditorResponsiveness()
This action returns how physics (linear velocity, angular velocity, force, torque) will affect the object. There are three possible values to be returned: 0 indicates that the object is UNMOVABLE, which means no matter what forces or torques is applied to the object, the object will not move. 1 indicates that the object is NON_RESPONSIVE, which means that only setting the angular velocity and linear velocity of this object will affect how the object behaves. 2 indicates that the object is REPONSIVE, which means that this object will behave differently when you apply forces and torques to this object.
Return
integer: Returns how physics will affect the object.
GetEditorRestitution()
This action returns how much energy that this object will loose after a collision.
Return
number: the coefficient of restitution.
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 FocusListeners.
GetGestureListeners()
This action returns an Iterator containing all of the GestureListeners that have been added to this Item using the AddGestureListener action.
Return
Libraries.Containers.Iterator: An iterator containing all of the registered GestureListeners.
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().
Return
number:
Example
use Libraries.Interface.Item2D
Item2D myItem
myItem:SetOffsetX(100)
myItem:SetX(30)
number globalX = myItem:GetGlobalX()
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().
Return
number:
Example
use Libraries.Interface.Item2D
Item2D myItem
myItem:SetOffsetY(60)
myItem:SetX(90)
number globalY = myItem:GetGlobalY()
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().
Return
number:
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetZ(40)
myItem:SetX(50)
number globalZ = myItem:GetGlobalZ()
GetHashCode()
This action gets the hash code for an object.
Return
integer: The integer hash code of the object.
Example
Object o
integer hash = o:GetHashCode()
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.
Return
text: The input group tag being used by this Item.
Example
use Libraries.Interface.Item
Item item
item:SetInputGroup("arrowKeys")
output "My item's input group is : " + item:GetInputGroup()
GetInputTable()
Return
GetItemCount()
This action will return the total number of children this Item has.
Return
integer: The number of children items this Item has.
Example
use Libraries.Interface.Item
Item parentItem
Item child1
child1:SetName("First")
parentItem:Add(child1)
Item child2
child2:SetName("Second")
parentItem:Add(child2)
Item child3
child3:SetName("Third")
parentItem:Add(child3)
integer counter = 0
repeat while counter < item:GetItemCount()
Item child = parentItem:GetChildAsItem(counter)
output child:GetName()
counter = counter + 1
end
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 MouseListeners.
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 MouseMovementListeners.
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 MouseWheelListeners.
GetName()
This action returns the current internal name of the Item.
Return
text:
Example
use Libraries.Interface.Item
Item item
item:SetName("My Item")
output "My item's name is " + item:GetName()
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 one.
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 one.
GetPropertiesSize()
Return
integer
GetProperty(text key)
GetPropertyKeyIterator()
GetSceneEditor()
Returns the SceneEditor object that this item is a part of.
Return
Libraries.Interface.Controls.Scenes.SceneEditor: The SceneEditor this item is attached to
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 TouchListeners.
GetX()
This action returns the currently set X coordinate of the Item.
Return
number:
Example
use Libraries.Interface.Item2D
Item2D myItem
number value = myItem:GetX()
GetY()
This action returns the currently set Y coordinate of the Item.
Return
number:
Example
use Libraries.Interface.Item2D
Item2D myItem
number value = myItem:GetY()
GetZ()
This action returns the currently set Z coordinate of the Item.
Return
number:
Example
use Libraries.Interface.Item3D
Item3D myItem
number value = myItem:GetZ()
HasProperties()
Return
boolean
HasProperty(text key)
Parameters
- text key
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
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 otherwise.
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 Item
Return
boolean:
IsEditorPhysicsEnabled()
This action returns true if physics is currently enabled for this item.
Return
boolean: True if physics is enabled, false otherwise.
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 not.
Return
boolean:
IsOnLayer()
This action returns true if the item has been added to a Layer, or false otherwise.
Return
boolean: True if the item is on a Layer, or false otherwise.
IsShowing()
This action returns whether the Item is currently set to be visible on the screen.
Return
boolean: A boolean representing whether or not the Item is currently visible.
Example
use Libraries.Interface.Item
Item item
item:Hide()
boolean visible = item:IsShowing()
LostFocus(Libraries.Interface.Events.FocusEvent event)
LostSelection()
Used Internally. This action returns the class that contains all the constants used by this object.
MoveX(number xAmount)
This action will increase the x-coordinate of this Item by the given amount.
Parameters
- number xAmount
Example
use Libraries.Interface.Item
Item myItem
myItem:SetX(50)
myItem:MoveX(25)
MoveY(number yAmount)
This action will increase the y-coordinate of this Item by the given amount.
Parameters
- number yAmount
Example
use Libraries.Interface.Item2D
Item2D myItem
myItem:SetY(50)
myItem:MoveY(25)
MoveZ(number zAmount)
This action will increase the z-coordinate of this Item by the given amount.
Parameters
- number zAmount
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetZ(50)
myItem:MoveZ(25)
NotifyAccessibility(text message)
This action is used to send a message down to the Accessibility system so the user can notified of something that has changed or something the user may need to know to understand what is happening.
Parameters
- text message
ProcessGestureEvent(Libraries.Interface.Events.GestureEvent event)
This action takes a gesture event and handles it. It will first test to see if the gesture event took place within the bounds of this Item. If so, it will notify any GestureListeners of the event. If the event was not contained within this Item, or if there are no GestureListeners on this Item, the Item will ask its parent Item to process the event, if there is a parent.
Parameters
Example
use Libraries.Interface.Item2D
use Libraries.Interface.Events.GestureEvent
use Libraries.Interface.Events.GestureListener
Item2D myItem
GestureListener listener
myItem:AddGestureListener(listener)
GestureEvent event
event:eventType = event:DOUBLE_TAP
myItem:ProcessGestureEvent(event)
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.
Parameters
Example
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(event)
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.
Parameters
Example
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(event)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.FocusListener
Item myItem
FocusListener listener
myItem:AddFocusListener(listener)
myItem:RemoveFocusListener(listener)
RemoveGestureListener(Libraries.Interface.Events.GestureListener listener)
This action removes a GestureListener from the Item. The listener will no longer receive notification if the Item gets a GestureEvent.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.GestureListener
Item myItem
GestureListener listener
myItem:AddGestureListener(listener)
myItem:RemoveGestureListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseListener
Item myItem
MouseListener listener
myItem:AddMouseListener(listener)
myItem:RemoveMouseListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseMovementListener
Item myItem
MouseMovementListener listener
myItem:AddMouseMovementListener(listener)
myItem:RemoveMouseMovementListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseWheelListener
Item myItem
MouseWheelListener listener
myItem:AddMouseWheelListener(listener)
myItem:RemoveMouseWheelListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.TouchListener
Item myItem
TouchListener listener
myItem:AddTouchListener(listener)
myItem:RemoveTouchListener(listener)
ResetScale()
ResetScale sets the scale of the object along each axis to the default which is usually 1. The scale of the object affects how large it is in the scene. So a scale of 2 on the x-axis means the object is twice as big on the x-axis than when normally sized.
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
- boolean accepts: True to set this Item to receive mouse events, or false to ignore them.
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
- integer newAccessibilityCode: the new accessibility code for this Item.
SetAccessibilityRoleDescription(text newRoleDescription)
This action sets a custom accessibility role description for this item. This should only be done if there is not a standard accessibility code for the type of item being implemented. If the item behaves very similarly to a standard control type, then set the accessibility code to that standard type while also setting the role description. For example, if implementing an item that extends Control, is keyboard focusable, and responds to activation via both mouse clicks and the Space key, like a button, but it shouldn't be described as a button, then set the accessibility code to BUTTON and the custom role description to whatever is appropriate. If there isn't a suitable accessibility code, or if in doubt, set the accessibility code to CUSTOM.
Parameters
- text newRoleDescription: the new custom role description for this Item.
SetDescription(text newDescription)
This action sets the internal description of the Item.
Parameters
- text newDescription
Example
use Libraries.Interface.Item
Item item
item:SetDescription("Used for demo purposes.")
SetEditorFriction(number friction)
This action sets the coefficient of friction that is stored inside this editor property holder.
Parameters
- number friction: the coefficient of friction.
SetEditorMass(number mass)
This action changes the mass of this object.
Parameters
- number mass: The mass of the object in kilograms.
SetEditorPhysicsEnabled(boolean enable)
This action sets whether or not this object will part of physics calculations that happen as the game runs. If phyics is not enabled then certain properties of the item will cause an error if the user attempts to view or change them. If physics is enabled than the object can be affected by force, and velocity calculations as the game runs.
Parameters
- boolean enable: If true the physics enabled property will be set to true, false otherwise
SetEditorResponsiveness(integer responsive)
This action sets how physics (linear velocity, angular velocity, force, torque) will affect the object. There are three possible values to be set: 0 indicates that the object is UNMOVABLE, which means no matter what forces or torques is applied to the object, the object will not move. 1 indicates that the object is NON_RESPONSIVE, which means that only setting the angular velocity and linear velocity of this object will affect how the object behaves. 2 indicates that the object is REPONSIVE, which means that this object will behave differently when you apply forces and torques to this object.
Parameters
- integer responsive: Integer representing how physics will affect the object.
SetEditorRestitution(number restitution)
This action sets how much energy that this object will loose after a collision. If you want the object to not loose any energy, then you can pass in 1.0. If you want the object to loose a lot of energy (meaning, they would probably move a lot slower after the collision), then you can pass in a 0.0. You can also use the values between 0 and 1.
Parameters
- number restitution: The coefficient of restitution.
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 element.
Parameters
- boolean focus
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.
Parameters
- text group: The new input group to use.
Example
use Libraries.Interface.Item
Item item
item:SetInputGroup("arrowKeys")
output "My item's input group is : " + item:GetInputGroup()
SetName(text newName)
This action sets the internal name of the Item.
Parameters
- text newName
Example
use Libraries.Interface.Item
Item item
item:SetName("My Item")
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
- Libraries.Interface.Item: The next Item to receive focus after this one.
SetPosition(number newX, number newY, number newZ)
This action will set both the X, Y, and Z coordinates of the Item, in that order.
Parameters
- number newX
- number newY
- number newZ
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetPosition(30, 70, 45)
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
- Libraries.Interface.Item: The previous Item to receive focus before this one.
SetProperty(text key, Libraries.Data.Formats.JavaScriptObjectNotation value)
Parameters
SetSceneEditor(Libraries.Interface.Controls.Scenes.SceneEditor editor)
Sets the SceneEditor object that this item is a part of.
Parameters
- Libraries.Interface.Controls.Scenes.SceneEditor: The SceneEditor this item is attached to
SetX(number setX)
This action sets the X coordinate of the Item.
Parameters
- number setX
Example
use Libraries.Interface.Item2D
Item2D myItem
myItem:SetX(35.0)
SetY(number setY)
This action sets the Y coordinate of the Item.
Parameters
- number setY
Example
use Libraries.Interface.Item2D
Item2D myItem
myItem:SetY(210.0)
SetZ(number setZ)
This action sets the Z coordinate of the Item.
Parameters
- number setZ
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetZ(180.0)
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
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.
Parameters
- number secondsSinceUpdate: The number of seconds that have passed since the last time Update was called.
Example
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
end
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.
Parameters
- number secondsSinceUpdate: The number of seconds that have passed since the last time Update was called.
Example
use Libraries.Interface.Item
Item parentItem
Item child1
Item child2
parentItem:Add(child1)
parentItem:Add(child2)
parentItem:UpdateAll(0)
On this page
Variables TableAction Documentation- AddBehavior(Libraries.Interface.Behaviors.Behavior behavior)
- AddFocusListener(Libraries.Interface.Events.FocusListener listener)
- AddGestureListener(Libraries.Interface.Events.GestureListener listener)
- AddMouseListener(Libraries.Interface.Events.MouseListener listener)
- AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)
- AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)
- AddTouchListener(Libraries.Interface.Events.TouchListener listener)
- BeginCollision(Libraries.Interface.Item item)
- CancelBehaviors()
- Compare(Libraries.Language.Object object)
- Dispose()
- DisposeAll()
- DisposeChildren()
- Empty()
- EmptyAll()
- EmptyChildren()
- Equals(Libraries.Language.Object object)
- FinishCollision(Libraries.Interface.Item item)
- Focus()
- GainedFocus(Libraries.Interface.Events.FocusEvent event)
- GainedSelection()
- GetAccessibilityCode()
- GetAccessibilityRoleDescription()
- GetAccessibilityType()
- GetAccessibleParent()
- GetChildAsItem(integer index)
- GetConstants()
- GetDescription()
- GetEditorFriction()
- GetEditorMass()
- GetEditorResponsiveness()
- GetEditorRestitution()
- GetFocusListeners()
- GetGestureListeners()
- GetGlobalX()
- GetGlobalY()
- GetGlobalZ()
- GetHashCode()
- GetInputGroup()
- GetInputTable()
- GetItemCount()
- GetMouseListeners()
- GetMouseMovementListeners()
- GetMouseWheelListeners()
- GetName()
- GetNextFocus()
- GetPreviousFocus()
- GetPropertiesSize()
- GetProperty(text key)
- GetPropertyKeyIterator()
- GetSceneEditor()
- GetTouchListeners()
- GetX()
- GetY()
- GetZ()
- HasProperties()
- HasProperty(text key)
- Hide()
- IsAcceptingMouseInput()
- IsAccessibleParent()
- IsEditorPhysicsEnabled()
- IsFocusable()
- IsFocused()
- IsOnLayer()
- IsShowing()
- LostFocus(Libraries.Interface.Events.FocusEvent event)
- LostSelection()
- MoveX(number xAmount)
- MoveY(number yAmount)
- MoveZ(number zAmount)
- NotifyAccessibility(text message)
- ProcessGestureEvent(Libraries.Interface.Events.GestureEvent event)
- ProcessMouseEvent(Libraries.Interface.Events.MouseEvent event)
- ProcessTouchEvent(Libraries.Interface.Events.TouchEvent event)
- RemoveFocusListener(Libraries.Interface.Events.FocusListener listener)
- RemoveGestureListener(Libraries.Interface.Events.GestureListener listener)
- RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)
- RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)
- RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)
- RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)
- ResetScale()
- SetAcceptsMouseInput(boolean accepts)
- SetAccessibilityCode(integer newAccessibilityCode)
- SetAccessibilityRoleDescription(text newRoleDescription)
- SetDescription(text newDescription)
- SetEditorFriction(number friction)
- SetEditorMass(number mass)
- SetEditorPhysicsEnabled(boolean enable)
- SetEditorResponsiveness(integer responsive)
- SetEditorRestitution(number restitution)
- SetFocusable(boolean focus)
- SetInputGroup(text group)
- SetName(text newName)
- SetNextFocus(Libraries.Interface.Item next)
- SetPosition(number newX, number newY, number newZ)
- SetPreviousFocus(Libraries.Interface.Item previous)
- SetProperty(text key, Libraries.Data.Formats.JavaScriptObjectNotation value)
- SetSceneEditor(Libraries.Interface.Controls.Scenes.SceneEditor editor)
- SetX(number setX)
- SetY(number setY)
- SetZ(number setZ)
- Show()
- Update(number secondsSinceUpdate)
- UpdateAll(number secondsSinceUpdate)