OnDgsMouseUp
From Multi Theft Auto: Wiki
This event is fired when the user releases his mouse button when on top of a DGS element.
Parameters
string button, int absoluteX, int absoluteY
- button: the name of the mouse button that was released on a DGS element, can be left, right, or middle.
- absoluteX: the X position of the mouse cursor, in pixels, measured from the left side of the screen.
- absoluteY: the Y position of the mouse cursor, in pixels, measured from the top of the screen.
Source
The source of this event is the DGS element on top of which the mouse button was released.
Example
This example show how to add very basic click'n'drag feature for DGS elements (only for those which parent element is dgs-root)
DGS = exports.dgs
addEventHandler( "onDgsMouseDown", getRootElement( ),
function ( btn, x, y )
if btn == "left" then
clickedElement = source; -- store the clicked element in a global variable
local elementPos = { DGS:dgsGetPosition( source, false ) };
offsetPos = { x - elementPos[ 1 ], y - elementPos[ 2 ] }; -- get the offset position
end
end
);
addEventHandler( "onDgsMouseUp", getRootElement( ),
function ( btn, x, y )
if btn == "left" then
clickedElement = nil;
end
end
);
addEventHandler( "onDgsMouseMove", getRootElement( ),
function ( x, y )
if clickedElement then
DGS:dgsSetPosition( clickedElement, x - offsetPos[ 1 ], y - offsetPos[ 2 ], false );
end
end
);
See Also
DGS events
- onDgsArrowListValueChange
- onDgsBlur
- onDgsCheckBoxChange
- onDgsComboBoxStateChange
- onDgsComboBoxSelect
- onDgsCreate
- onDgsDestroy
- onDgsEditPreSwitch
- onDgsEditSwitched
- onDgsEditAccepted
- onDgsElementRender
- onDgsElementMove
- onDgsElementSize
- onDgsFocus
- onDgsGridListItemDoubleClick
- onDgsGridListSelect
- onDgsMouseClick
- onDgsMouseClickDown
- onDgsMouseClickUp
- onDgsMouseDrag
- onDgsMouseDoubleClick
- onDgsMouseDown
- onDgsMouseEnter
- onDgsMouseLeave
- onDgsMouseMove
- onDgsMouseUp
- onDgsMouseWheel
- onDgsRadioButtonChange
- onDgsPositionChange
- onDgsPreRender
- onDgsRender
- onDgsElementScroll
- onDgsSizeChange
- onDgsTabPanelTabSelect
- onDgsTabSelect
- onDgsTextChange
- onDgsWindowClose
Plugin
Media
- onDgsMediaPlay
- onDgsMediaPause
- onDgsMediaStop
- onDgsMediaDurationGet
- onDgsMediaTimeUpdate
- onDgsMediaBrowserReturn