OnDgsGridListItemDoubleClick: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client event}} _NOTOC_ This event is activated each time the user double-clicks an item in the list of gridlist DGS. ==Parameters== <syntaxhighlight lang="lua"> element th...")
 
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Client event}}
{{Client event}}
_NOTOC_
__NOTOC__
This event is activated each time the user double-clicks an item in the list of gridlist DGS.
This event is activated each time the user double-clicks an item in the element dgs-gridlist.


==Parameters==  
==Parameters==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
element theElement
string button, string state, number itemID
</syntaxhighlight>  
</syntaxhighlight>
* '''theElement''': The dgs element that was double clicked.
*'''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 15: Line 18:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">


DGS = exports.dgs
local DGS = exports.dgs


gridlist = DGS:dgsDxCreateGridList(0.4, 0.4, 0.3, 0.3, true)
local gridlist = DGS:dgsCreateGridList(0.4, 0.4, 0.3, 0.3, true)
column = DGS:dgsDxGridListAddColumn( gridlist, "Items", 0.6 )
local column = DGS:dgsGridListAddColumn( gridlist, "Items", 0.6 )


for i = 0, 10 do
for i = 0, 10 do
     local row = DGS:dgsDxGridListAddRow(gridlist)  
     local row = DGS:dgsGridListAddRow(gridlist)  
     DGS:dgsDxGridListSetItemText(gridlist, row, column, i)  
     DGS:dgsGridListSetItemText(gridlist, row, column, i)  
end
end


addEventHandler( "onClientDgsDxGridListItemDoubleClick", root,  
addEventHandler( "onDgsGridListItemDoubleClick", root,  
     function(element)
     function(button,state,item)
         if element and (element ~= -1) then
         if button == "left" and state == "down" then
             local text = DGS:dgsDxGridListGetItemText(gridlist , element, column)
             local text = DGS:dgsGridListGetItemText(gridlist , item, column)
        outputChatBox( "The number is "..text)
    outputChatBox( "The number is "..text)
         end
         end
     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

Check Box

Combo Box

Drag'N Drop

Edit

Grid List

Menu

Selector

Mouse

Radio Button

Switch Button

Tab

Animation

Plugin

Media

Color Picker

QRCode

Remote Image

Client event functions