DgsAddMoveHandler: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(DGS OOP Syntax changing) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
This function can make dgs element movable like a window. | This function can make dgs element movable like a window. | ||
'''Note: If | '''Note: If applying move handler on dgs window, the original move handler will be replaced. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
string dgsAddMoveHandler( element dgsElement [, float x = 0,float y = 0, float width = | string dgsAddMoveHandler( element dgsElement [, float x = 0,float y = 0, float width = 1, float height = 1, bool relativeX = true, bool relativeY = true, bool relativeW = true, bool relativeH = true ] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{DGS/OOP| | |||
Method = DGSElement:addMoveHandler| | |||
Counterpart = dgsRemoveMoveHandler | |||
}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''dgsElement:''' The dgs element you want to | *'''dgsElement:''' The dgs element you want to add move handler to. | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
Line 20: | Line 24: | ||
*'''relativeX:''' This is whether x position is relative. If this is true, then x floats must be between 0 and 1, representing sizes relative to the parent. | *'''relativeX:''' This is whether x position is relative. If this is true, then x floats must be between 0 and 1, representing sizes relative to the parent. | ||
*'''relativeY:''' This is whether y position is relative. If this is true, then y floats must be between 0 and 1, representing sizes relative to the parent. | *'''relativeY:''' This is whether y position is relative. If this is true, then y floats must be between 0 and 1, representing sizes relative to the parent. | ||
*'''relativeW:''' This is whether | *'''relativeW:''' This is whether width is relative. If this is true, then width floats must be between 0 and 1, representing sizes relative to the parent. | ||
*'''relativeH:''' This is whether | *'''relativeH:''' This is whether height is relative. If this is true, then height floats must be between 0 and 1, representing sizes relative to the parent. | ||
===Returns=== | ===Returns=== | ||
Line 33: | Line 37: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=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 22:52, 3 May 2021
This function can make dgs element movable like a window.
Note: If applying move handler on dgs window, the original move handler will be replaced.
Syntax
string dgsAddMoveHandler( element dgsElement [, float x = 0,float y = 0, float width = 1, float height = 1, bool relativeX = true, bool relativeY = true, bool relativeW = true, bool relativeH = true ] )
DGS OOP Syntax Help! I don't understand this!
- Method: DGSElement:addMoveHandler(...)
- Counterpart: dgsRemoveMoveHandler
Required Arguments
- dgsElement: The dgs element you want to add move handler to.
Optional Arguments
- x: A float of the 2D x position of the DGS move handler relative to the dgs element. This is affected by the relativeX argument.
- y: A float of the 2D y position of the DGS move handler relative to the dgs element. This is affected by the relativeY argument.
- width: A float of the width of the DGS move handler. This is affected by the relativeW argument.
- height: A float of the height of the DGS move handler. This is affected by the relativeH argument.
- relativeX: This is whether x position is relative. If this is true, then x floats must be between 0 and 1, representing sizes relative to the parent.
- relativeY: This is whether y position is relative. If this is true, then y floats must be between 0 and 1, representing sizes relative to the parent.
- relativeW: This is whether width is relative. If this is true, then width floats must be between 0 and 1, representing sizes relative to the parent.
- relativeH: This is whether height is relative. If this is true, then height floats must be between 0 and 1, representing sizes relative to the parent.
Returns
Returns true if succeed, false otherwise
Example
DGS = exports.dgs local button = DGS:dgsCreateButton(0.2,0.2,0.2,0.1,"test",true) DGS:dgsAddMoveHandler(button,0,0,1,1)
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