From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function is used for setting a DGS element as the parent of another DGS element.

[[{{{image}}}|link=|]] Note: DGS elements are always destroyed when the resource that created them is stopped.
[[{{{image}}}|link=|]] Note: dgsSetParent only works with DGS elements.


bool dgsSetParent( element theElement, element parent )  

DGS OOP Syntax Help! I don't understand this!

Required Arguments

  • theElement: The dgs element that you wish to set the parent of.
  • parent: The dgs element you wish to be the parent of theElement.


Returns true if both elements are valid, false otherwise.


DGS = exports.dgs
parent = DGS:dgsCreateWindow( 500, 500, 300, 300, "test window", false ) -- create a window
label = DGS:dgsCreateLabel( 0, 0, 300, 20, "test label", false ) -- create a label that its parent is the screen
DGS:dgsSetParent(label, parent) -- set the window as the parent of the label

See Also

General Functions

General Events