GetTopModal()
Description
Section titled âDescriptionâThe GetTopModal Lua function returns a handle for the modal at the top. Modal is the internal name for pop-ups that interrupt the systemâs normal operation. A modal blocks other UI elements from being used while it is open.
For example, when opening a windowâs settings pop-up, it is not possible to use the command line. The settings pop-up is a modal. Modals can also be identified by the rest of the UI, which darkens a bit when it is open.
Argument
Section titled âArgumentâThis function does not have any arguments.
- Handle | nil:
The function returns a handle to the top modal UI object if there is one.
Example
Section titled âExampleâThis example uses the Dump() function to show information about the StagePopup selection pop-up.
The Dump() function returns a string with information about the object, for instance, the name, class, path of the object, its properties, and children.
Learn more in the Dump() topic.
| Copy CodeLua |
| ``` |
| return function() |
-- Open a Modal / Pop-up.Cmd('Menu "StagePopup"')-- Add a small wait.coroutine.yield(0.5)-- Get the handle for the modal / pop-up.local modalHandle = GetTopModal()-- If there is a handle then dump all information else print en error feedback.if modalHandle ~= nil then Printf("=============== START OF DUMP ===============") modalHandle:Dump() Printf("================ END OF DUMP ================")else ErrPrintf("The Modal UI object could not be found.")end-- Close the modal / pop-up by pressing the Escape key.Keyboard(1,'press','Escape')Keyboard(1,'release','Escape')end