DgsGetChild: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ {{Client function}} This function returns one of the child dgs elements of a given parent dgs element. The child dgs element is selected by its index (0 for the fir...") |
m (DGS OOP Syntax changing) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 6: | Line 6: | ||
element dgsGetChild ( element dgsParent, int index ) | element dgsGetChild ( element dgsParent, int index ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{DGS/OOP| | |||
Method = DGSElement:getChild | |||
}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 18: | Line 21: | ||
DGS = exports.dgs | DGS = exports.dgs | ||
parent = DGS: | parent = DGS:dgsCreateWindow(200,100,400,400,"DGS Parent Window",false) --Create a window | ||
child1 = DGS: | child1 = DGS:dgsCreateLabel(10,0,380,20,"",false,parent) --Create child 1 | ||
child2 = DGS: | child2 = DGS:dgsCreateLabel(10,20,380,20,"",false,parent) --Create child 2 | ||
child3 = DGS: | child3 = DGS:dgsCreateLabel(10,40,380,20,"",false,parent) --Create child 3 | ||
child4 = DGS: | child4 = DGS:dgsCreateLabel(10,60,380,20,"",false,parent) --Create child 4 | ||
--Set a random number to a random child. | --Set a random number to a random child. | ||
Line 28: | Line 31: | ||
local child = DGS:dgsGetChild(parent,math.random(1,4)) | local child = DGS:dgsGetChild(parent,math.random(1,4)) | ||
if isElement(child) then | if isElement(child) then | ||
DGS: | DGS:dgsSetText(child,math.random(1,100)) | ||
end | end | ||
end,1000,0) | end,1000,0) | ||
Line 34: | Line 37: | ||
==See Also== | ==See Also== | ||
{{ | |||
===<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Functions</span>=== | |||
{{DGS General Functions}} | |||
===<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Events</span>=== | |||
{{DGS Events/General}} |
Latest revision as of 18:59, 3 May 2021
This function returns one of the child dgs elements of a given parent dgs element. The child dgs element is selected by its index (0 for the first child, 1 for the second and so on).
Syntax
element dgsGetChild ( element dgsParent, int index )
DGS OOP Syntax Help! I don't understand this!
- Method: DGSElement:getChild(...)
Required Arguments
- dgsParent: the dgs element above the one to be returned in the hierarchy.
- index: the dgs element's index (1 for the first element, 2 for the second, etc).
Returns
Returns the requested dgs element if it exists, or false if it doesn't.
Example
DGS = exports.dgs parent = DGS:dgsCreateWindow(200,100,400,400,"DGS Parent Window",false) --Create a window child1 = DGS:dgsCreateLabel(10,0,380,20,"",false,parent) --Create child 1 child2 = DGS:dgsCreateLabel(10,20,380,20,"",false,parent) --Create child 2 child3 = DGS:dgsCreateLabel(10,40,380,20,"",false,parent) --Create child 3 child4 = DGS:dgsCreateLabel(10,60,380,20,"",false,parent) --Create child 4 --Set a random number to a random child. setTimer(function() local child = DGS:dgsGetChild(parent,math.random(1,4)) if isElement(child) then DGS:dgsSetText(child,math.random(1,100)) end end,1000,0)
See Also
General Functions
- dgsGetPosition
- dgsSetPosition
- dgsSetParent
- dgsGetParent
- dgsGetChild
- dgsGetChildren
- dgsGetSize
- dgsSetSize
- dgsGetType
- dgsSetLayer
- dgsGetLayer
- dgsSetCurrentLayerIndex
- dgsGetCurrentLayerIndex
- dgsGetLayerElements
- dgsGetProperty
- dgsSetProperty
- dgsSetPropertyInherit
- dgsGetProperties
- dgsSetProperties
- dgsGetVisible
- dgsSetVisible
- dgsGetEnabled
- dgsSetEnabled
- dgsGetPositionAlignment
- dgsSetPositionAlignment
- dgsGetAlpha
- dgsSetAlpha
- dgsGetFont
- dgsSetFont
- dgsGetText
- dgsSetText
- dgsGetPostGUI
- dgsSetPostGUI
- dgsGetInputEnabled
- dgsSetInputEnabled
- dgsGetInputMode
- dgsSetInputMode
- dgsAttachToAutoDestroy
- dgsDetachFromAutoDestroy
- dgsFocus
- dgsBlur
- dgsCreateFont
- dgsBringToFront
- dgsMoveToBack
- dgsGetScreenSize
- dgsGetCursorPosition
- dgsGetMouseEnterGUI
- dgsGetMouseLeaveGUI
- dgsIsMouseWithinGUI
- dgsSetSystemFont
- dgsGetSystemFont
- dgsGetElementsInLayer
- dgsGetElementsFromResource
- dgsGetFocusedGUI
- dgsImportFunction
- dgsImportOOPClass
- dgsG2DLoadHooker
- dgsSetRenderSetting
- dgsGetRenderSetting
- dgsSimulateClick
- dgsGetRootElement
- dgsAddMoveHandler
- dgsRemoveMoveHandler
- dgsIsMoveHandled
- dgsAddSizeHandler
- dgsRemoveSizeHandler
- dgsIsSizeHandled
- dgsAttachElements
- dgsDetachElements
- dgsElementIsAttached
- dgsAddPropertyListener
- dgsRemovePropertyListener
- dgsGetListenedProperties
- dgsSetMultiClickInterval
- dgsGetMultiClickInterval
- dgsSetMouseStayDelay
- dgsGetMouseStayDelay
- dgsCenterElement
- dgsSetElementKeeperEnabled
- dgsGetElementKeeperEnabled
- dgsSetClickingSound
- dgsGetClickingSound
- dgsSetClickingSoundVolume
- dgsGetClickingSoundVolume
General Events
- onDgsBlur
- onDgsCreate
- onDgsCursorTypeChange
- onDgsCursorStateChange
- onDgsDestroy
- onDgsElementRender
- onDgsElementMove
- onDgsElementSize
- onDgsElementEnter
- onDgsElementLeave
- onDgsFocus
- onDgsKey
- onDgsPositionChange
- onDgsPreRender
- onDgsRender
- onDgsElementScroll
- onDgsSizeChange
- onDgsTextChange
- onDgsWindowClose
- onDgsPropertyChange