OnDgsMenuSelect

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

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