OnDgsMenuSelect: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client event}} __NOTOC__ This event is fired when the item of a DGS menu is clicked. ==Parameters== <syntaxhighlight lang="lua"> dgs-dxmenu subMenu, integer itemUniqueIndex </syntaxhighlight> * '''subMenu''': The sub dgs-dxmenu that the item in. * '''previous''': The item id that last selected. ==Source== The source of this event is the root dgs menu element. ==Example== <syntaxhighlight lang="lua"> DGS = exports.dgs local menu = DG...")
 
No edit summary
 
Line 8: Line 8:
</syntaxhighlight>
</syntaxhighlight>
* '''subMenu''': The sub dgs-dxmenu that the item in.
* '''subMenu''': The sub dgs-dxmenu that the item in.
* '''previous''':  The item id that last selected.
* '''itemUniqueIndex''':  The item id.


==Source==
==Source==

Latest revision as of 07:34, 12 August 2023

This event is fired when the item of a DGS menu is clicked.

Parameters

dgs-dxmenu subMenu, integer itemUniqueIndex
  • subMenu: The sub dgs-dxmenu that the item in.
  • itemUniqueIndex: The item id.

Source

The source of this event is the root dgs menu element.

Example

DGS = exports.dgs
local menu = DGS:dgsCreateMenu(200,200,200,600,false)
local item = DGS:dgsMenuAddItem(menu,"test1","test1")
	local item2 = DGS:dgsMenuAddItem(menu,"test2","test2",item)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)
DGS:dgsMenuAddSeparator(menu)
local item = DGS:dgsMenuAddItem(menu,"test3","test3")
	local item2 = DGS:dgsMenuAddItem(menu,"test2","test2",item)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)
		DGS:dgsMenuAddItem(menu,"test2","test2",item2)

local button = DGS:dgsCreateButton(200,200,300,300,"what",false)
addEventHandler("onDgsMouseClickUp",button,function(button)
	if button == "right" then
		DGS:dgsMenuShow(menu)
	end
end)

addEventHandler("onDgsMenuSelect",menu,function(subMenu,uniqueID)
	iprint("select",subMenu,uniqueID)
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