DxAddRenderFunction
Jump to navigation
Jump to search
This function allows you to bind a function to a DxElement's render handler.
Syntax
bool dxAddRenderFunction ( DxElement dxElement, function handlerFunction )
OOP Syntax Help! I don't understand this!
- Method: DxElement:addRenderFunction(...)
Required Arguments
- dxElement: element you wish to bind a render function to
- handlerFunction: the handler function you wish to bind
Returns
Returns true if the function was bound successfully, false otherwise.
Example
This example sets a DxWindow to a random position every time it is hovered over, using a render function.
local screenWidth, screenHeight = guiGetScreenSize() local window = DxWindow:new(0, 0, 300, 300, "My Window") function myRenderFunction() if(isMouseOverDxElement(window)) then dxSetPosition(window, math.random(screenWidth), math.random(screenHeight)) end end dxAddRenderFunction(window, myRenderFunction)
Note: inside a bound render function, you can also use the predefined variable "self" (instead of "window", in this instance).
See Also
- dxAddClickFunction
- dxAddRenderFunction
- dxApplyMask
- dxBringToFront
- dxDestroy
- dxGetAlpha
- dxGetBounds
- dxGetChildren
- dxGetChildrenByType
- dxGetColor
- dxGetGlobalProperty
- dxGetHoverColor
- dxGetIndex
- dxGetInheritedBounds
- dxGetInheritedChildren
- dxGetInheritedChildrenByType
- dxGetInheritedParents
- dxGetMaskTexture
- dxGetNonRootElements
- dxGetObstructingElement
- dxGetParent
- dxGetPosition
- dxGetProperty
- dxGetRootElement
- dxGetRootElements
- dxGetSize
- dxGetText
- dxGetTextColor
- dxGetTexture
- dxGetTopLevelChildren
- dxGetVisible
- dxIsChild
- dxIsFront
- dxIsInheritedChild
- dxIsObstructed
- dxIsObstructedByElement
- dxIsParent
- dxIsRootElement
- dxRemoveClickFunction
- dxRemoveRenderFunction
- dxSendToBack
- dxSetAlpha
- dxSetCentered
- dxSetColor
- dxSetDragArea
- dxSetGlobalProperty
- dxSetHoverColor
- dxSetIndex
- dxSetMaskEnabled
- dxSetParent
- dxSetPosition
- dxSetProperty
- dxSetSize
- dxSetText
- dxSetTextColor
- dxSetVisible
- isMouseOverDxElement