CONTROL

CONTROL is the class for Lua objects that represent Storyboard control model objects. CONTROL extends DOMOBJECT so objects of this type can also invoke all the functions of DOMOBJECT. In Lua, this class is called gredom#control.

CONTROL:get_x

CONTROL:get_x()

Get the value of grd_x for this control.

Returns: The grd_x value of this control

CONTROL:get_y

CONTROL:get_y()

Get the value of grd_y for this control.

Returns: The grd_y value of this control

CONTROL:get_width

CONTROL:get_width()

Get the value of grd_width for this control.

Returns: The grd_width value of this control

CONTROL:get_height

CONTROL:get_height()

Get the value of grd_height for this control.

Returns: The grd_height value of this control

CONTROL:get_position

CONTROL:get_position()

Get the value of grd_x and grd_y for this control.

Returns: The grd_x value of this control The grd_y value of this control

CONTROL:get_size

CONTROL:get_size()

Get the value of grd_width and grd_height for this control.

Returns: The grd_width value of this control The grd_height value of this control

CONTROL:get_bounds

CONTROL:get_bounds()

Get the value of grd_x, grd_y, grd_width and grd_height for this control.

Returns: The grd_x value of this control The grd_y value of this control The grd_width value of this control The grd_height value of this control

CONTROL:get_hidden

CONTROL:get_hidden()

Get the value of grd_hidden for this control.

Returns: The grd_hidden value of this control

CONTROL:set_x

CONTROL:set_x( 
    x,
    [anchor]
)

Set the value of grd_x for this control to the provided value with an optional anchor allow for automatic adjustment of x value.

Horizontal:

  • grd.LEFT anchor will not adjust the input. This is the default behavior.

  • grd.CENTER anchor will adjust the x input by half the control width.

  • grd.RIGHT anchor will adjust the x input by the full control width.

Parameters: x An integer value to set to grd_x of this control anchor Horizontal anchor: gre.LEFT, gre.CENTER, gre.RIGHT (Optional, default is gre.LEFT)

CONTROL:set_y

CONTROL:set_y(
    y,
    [anchor]
)

Set the value of grd_y for this control to the provided value with an optional anchor allow for automatic adjustment of y value.

Vertical:

  • grd.TOP anchor will not adjust the input. This is the default behavior.

  • grd.CENTER anchor will adjust the y input by half the control height.

  • grd.BOTTOM anchor will adjust the y input by the full control height.

Parameters: y An integer value to set to grd_y of this control anchor Vertical anchor: gre.TOP, gre.CENTER, gre.BOTTOM (Optional, default is gre.TOP)

CONTROL:set_width

CONTROL:set_width(
    width,
    [anchor]
)

Set the value of grd_width for this control to the provided value with optional anchors to allow for automatic adjustment of the control's x to keep the control anchored in the desired position as the control's width change.

Horizontal:

  • grd.LEFT anchor will not adjust the control's x position. This is the default behavior.

  • grd.CENTER anchor will adjust the control's x position by half the difference in control width.

  • grd.RIGHT anchor will adjust the control's x position by the difference in control width.

Parameters: width An integer value to set to grd_width of this control anchor Horizontal anchor: gre.LEFT, gre.CENTER, gre.RIGHT (Optional, default is gre.LEFT)

CONTROL:set_height

CONTROL:set_height(
    height,
    [anchor]
)

Set the value of grd_height for this control to the provided value with optional anchors to allow for automatic adjustment of the control's y to keep the control anchored in the desired position as the control's height change.

Vertical:

  • grd.TOP anchor will not adjust the control's y position. This is the default behavior.

  • grd.CENTER anchor will adjust the control's y position by half the difference in control height.

  • grd.BOTTOM anchor will adjust the control's y position the difference in control height.

Parameters: height An integer value to set to grd_height of this control anchor Vertical anchor: gre.TOP, gre.CENTER, gre.BOTTOM (Optional, default is gre.TOP)

CONTROL:set_position

CONTROL:set_position(
    x,
    y,
    [ah],
    [av]
)

Set the value of grd_x and grd_y for this control to the provided values with optional anchors to allow for automatic adjustment of x and y values.

Horizontal:

  • grd.LEFT anchor will not adjust the input. This is the default behavior.

  • grd.CENTER anchor will adjust the x input by half the control width.

  • grd.RIGHT anchor will adjust the x input by the full control width.

Vertical:

  • grd.TOP anchor will not adjust the input. This is the default behavior.

  • grd.CENTER anchor will adjust the y input by half the control height.

  • grd.BOTTOM anchor will adjust the y input by the full control height.

Parameters: x An integer value to set to grd_x of this control y An integer value to set to grd_y of this control ah Horizontal anchor: gre.LEFT, gre.CENTER, gre.RIGHT (Optional, default is gre.LEFT) av Vertical anchor: gre.TOP, gre.CENTER, gre.BOTTOM (Optional, default is gre.TOP)

CONTROL:set_size

CONTROL:set_size(
    width,
    height,
    [ah],
    [av]
)

Set the value of grd_width and grd_height for this control to the provided values with optional anchors can allow for automatic adjustment of the control's x and y to keep the control anchored in the desired position as the control's size changes.

Horizontal:

  • grd.LEFT anchor will not adjust the control's x position. This is the default behavior.

  • grd.CENTER anchor will adjust the control's x position by half the difference in control width.

  • grd.RIGHT anchor will adjust the control's x position by the difference in control width.

Vertical:

  • grd.TOP anchor will not adjust the control's y position. This is the default behavior.

  • grd.CENTER anchor will adjust the control's y position by half the difference in control height.

  • grd.BOTTOM anchor will adjust the control's y position the difference in control height.

Parameters: width An integer value to set to grd_width of this control height An integer value to set to grd_height of this control ah Horizontal anchor: gre.LEFT, gre.CENTER, gre.RIGHT (Optional, default is gre.LEFT) av Vertical anchor: gre.TOP, gre.CENTER, gre.BOTTOM (Optional, default is gre.TOP)

CONTROL:set_bounds

CONTROL:set_bounds(
    x,
    y,
    width,
    height
)

Set the value of grd_x, grd_y, grd_width and grd_height for this control to the provided values.

Parameters: x An integer value to set to grd_x of this control y An integer value to set to grd_y of this control width An integer value to set to grd_width of this control height An integer value to set to grd_height of this control

CONTROL:set_hidden

CONTROL:set_hidden(
    hidden
)

Set the value of grd_hidden to the provided value.

Parameters: hidden An integer value to set to grd_hidden of this control

CONTROL:hide

CONTROL:hide()

Set the value of grd_hidden for this control to 1.

CONTROL:show

CONTROL:show()

Set the value of grd_hidden for this control to 0.

CONTROL:clone

CONTROL:clone(
    new_object_name,
    parent_name,
    data
)

Create a new control (new_object_name), within an existing parent layer or group (parent_name) by copying all of the properties of this control. This new object will have all of the same actions, variables and it's current state will match the state of this control.

  • Controls and tables can be cloned into either layer or group parents as long as no name conflict exists.

The data argument is a table of properties that match the properties for that type of object as described in the gre.set_control_attrs or gre.set_table_attrs functions as applicable.

Parameters: new_object_name The name for the new object, this must be a unique name in the parents namespace parent_name The name of the layer or group to place this object within, this object must exist data Optional: A table containing control attribute tags as the keys with new values to be applied. Returns: A CONTROL object representing the newly created control.

CONTROL:delete

CONTROL:delete()

Delete this control. This function only works on controls that were created as clones of other controls.

Was this article helpful?
0 out of 0 found this helpful