OnDgsGridListItemDoubleClick: Difference between revisions
Jump to navigation
Jump to search
m (Thisdp moved page OnClientDgsDxGridListItemDoubleClick to OnDgsGridListItemDoubleClick) |
|||
(7 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
string button, string state, number itemID | |||
</syntaxhighlight> | </syntaxhighlight> | ||
* ''' | *'''button''': the name of the mouse button that the DGS element was double clicked with. | ||
*'''state''': the state of the mouse button. "down" or "up". | |||
* '''itemID''': The index of item of dgs gridlist that was double clicked. | |||
==Source== | ==Source== | ||
The [[event system#Event source|source]] of this event is the DGS element that was double clicked. | The [[event system#Event source|source]] of this event is the DGS element that was double clicked. | ||
Line 17: | Line 20: | ||
local DGS = exports.dgs | local DGS = exports.dgs | ||
local gridlist = DGS: | local gridlist = DGS:dgsCreateGridList(0.4, 0.4, 0.3, 0.3, true) | ||
local column = DGS: | local column = DGS:dgsGridListAddColumn( gridlist, "Items", 0.6 ) | ||
for i = 0, 10 do | for i = 0, 10 do | ||
local row = DGS: | local row = DGS:dgsGridListAddRow(gridlist) | ||
DGS: | DGS:dgsGridListSetItemText(gridlist, row, column, i) | ||
end | end | ||
addEventHandler( " | addEventHandler( "onDgsGridListItemDoubleClick", root, | ||
function( | function(button,state,item) | ||
if | if button == "left" and state == "down" then | ||
local text = DGS: | local text = DGS:dgsGridListGetItemText(gridlist , item, column) | ||
outputChatBox( "The number is "..text) | outputChatBox( "The number is "..text) | ||
end | end |
Latest revision as of 13:41, 20 January 2018
This event is activated each time the user double-clicks an item in the element dgs-gridlist.
Parameters
string button, string state, number itemID
- button: the name of the mouse button that the DGS element was double clicked with.
- state: the state of the mouse button. "down" or "up".
- itemID: The index of item of dgs gridlist that was double clicked.
Source
The source of this event is the DGS element that was double clicked.
Example
This example creates a list of grids and prints the items that were double-clicked:
local DGS = exports.dgs local gridlist = DGS:dgsCreateGridList(0.4, 0.4, 0.3, 0.3, true) local column = DGS:dgsGridListAddColumn( gridlist, "Items", 0.6 ) for i = 0, 10 do local row = DGS:dgsGridListAddRow(gridlist) DGS:dgsGridListSetItemText(gridlist, row, column, i) end addEventHandler( "onDgsGridListItemDoubleClick", root, function(button,state,item) if button == "left" and state == "down" then local text = DGS:dgsGridListGetItemText(gridlist , item, column) outputChatBox( "The number is "..text) end 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