OnDgsMousePreClick: Difference between revisions
Jump to navigation
Jump to search
Line 23: | Line 23: | ||
btnOutput = DGS:dgsCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) | btnOutput = DGS:dgsCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) | ||
addEventHandler ( "onDgsMousePreClick", btnOutput, onPreClick ) | addEventHandler ( "onDgsMousePreClick", btnOutput, onPreClick ) | ||
addEventHandler ( "onDgsMouseClick", btnOutput, onClick ) | addEventHandler ( "onDgsMouseClick", btnOutput, onClick ) | ||
state = false | |||
function onPreClick ( button, state, x, y, isCoolingDown ) | function onPreClick ( button, state, x, y, isCoolingDown ) | ||
if | state = not state | ||
outputChatBox(" | if state then | ||
outputChatBox("Pre Click Cancelled") | |||
cancelEvent() | cancelEvent() | ||
else | else |
Latest revision as of 05:21, 2 June 2024
This event happens when any dgs-element clicked
Parameters
string button, string state, int absoluteX, int absoluteY, bool isCoolingDown
- button: the name of the button which will be clicked , it can be left, right, middle
- state: the state of the mouse button, will be down if the mouse button was pushed, or up if it was released. Please note currently both up and down state are supported.
- 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.
- isCoolingDown: A bool indicates whether this dgs element is cooling down. See Property:clickCoolDown
Source
The source of this event is the DGS element that was clicked.
Example
DGS = exports.dgs btnOutput = DGS:dgsCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) addEventHandler ( "onDgsMousePreClick", btnOutput, onPreClick ) addEventHandler ( "onDgsMouseClick", btnOutput, onClick ) state = false function onPreClick ( button, state, x, y, isCoolingDown ) state = not state if state then outputChatBox("Pre Click Cancelled") cancelEvent() else outputChatBox("Pre Click") end end function onClick ( button, state ) --Event is canceled, no longer triggers outputChatBox("Click") end
See Also
DGS events
General
- onDgsBlur
- onDgsCreate
- onDgsCursorTypeChange
- onDgsCursorStateChange
- onDgsDestroy
- onDgsElementRender
- onDgsElementMove
- onDgsElementSize
- onDgsElementEnter
- onDgsElementLeave
- onDgsFocus
- onDgsKey
- onDgsPositionChange
- onDgsPreRender
- onDgsRender
- onDgsElementScroll
- onDgsSizeChange
- onDgsTextChange
- onDgsWindowClose
- onDgsPropertyChange
Check Box
Combo Box
Drag'N Drop
Edit
Grid List
Menu
Selector
Mouse
- onDgsMousePreClick
- onDgsMouseClick
- onDgsMouseClickDown
- onDgsMouseClickUp
- onDgsMouseDrag
- onDgsMouseDoubleClick
- onDgsMouseDoubleClickDown
- onDgsMouseDoubleClickUp
- onDgsMouseDown
- onDgsMouseHover
- onDgsMouseEnter
- onDgsMouseLeave
- onDgsMouseMultiClick
- onDgsMouseMove
- onDgsMouseStay
- onDgsMouseUp
- onDgsMouseWheel
Radio Button
Switch Button
Tab
Animation
Plugin
Media
- onDgsMediaPlay
- onDgsMediaPause
- onDgsMediaStop
- onDgsMediaLoaded
- onDgsMediaTimeUpdate
- onDgsMediaBrowserReturn
Color Picker
QRCode
Remote Image
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled