OnDgsMenuSelect

From Multi Theft Auto: Wiki
Revision as of 07:34, 12 August 2023 by Thisdp (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.
  • previous: The item id that last selected.

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