DgsMenuHide: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{client function}} __NOTOC__ This function hides a DGS menu and cleans up any associated submenus. ==Syntax== <syntaxhighlight lang="lua"> bool dgsMenuHide ( element menu ) </syntaxhighlight> ===Required Arguments=== *'''menu:''' The DGS menu element to hide ===Returns=== Returns ''true'' if the menu was hidden successfully, ''false'' otherwise. ==Examples== <syntaxhighlight lang="lua"> loadstring(exports.dgs:dgsImportFunction())()-- load functions -- Create a menu...") |
No edit summary |
||
| Line 54: | Line 54: | ||
==Author== | ==Author== | ||
[[User:Mohab|Mohab]]. | [[User:Mohab|Mohab]]. | ||
Latest revision as of 04:50, 10 July 2025
This function hides a DGS menu and cleans up any associated submenus.
Syntax
bool dgsMenuHide ( element menu )
Required Arguments
- menu: The DGS menu element to hide
Returns
Returns true if the menu was hidden successfully, false otherwise.
Examples
loadstring(exports.dgs:dgsImportFunction())()-- load functions
-- Create a menu
local menu = dgsCreateMenu(200, 200, 150, 120, false)
dgsMenuAddItem(menu, "New File", "new")
dgsMenuAddItem(menu, "Open File", "open")
dgsMenuAddSeparator(menu)
dgsMenuAddItem(menu, "Exit", "exit")
-- Show the menu
dgsMenuShow(menu)
-- Handle menu selection
addEventHandler("onDgsMenuSelect", menu, function(subMenu, uniqueID)
if uniqueID == -1 then return end
local command = dgsMenuGetItemCommand(source, uniqueID)
if command == "exit" then
dgsMenuHide(source)
outputChatBox("Menu closed!")
else
outputChatBox("Selected: " .. command)
end
end, false)