ActivateMenu

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


Menu

native void ActivateMenu()

Usage

When called on a menu object, sets it as the currently active menu. This can be used to get around the issue with SetMenu() where menus not defined in MENUDEF have to inherit from GenericMenu. Note that the menu's Init() function won't be called and must be done manually if that's desired. Any sort of auto activation behavior will not work either. For special menus that require a parameter, this won't be able to set it. This is best used for temporary menus such as those that capture input to send back to another menu.

Examples

// From OptionMenuItemControlBase, an option menu item designed to bind commands to an input
override bool Activate()
{
    Menu.MenuSound("menu/choose");
    mWaiting = true;

    let input = new("EnterKey"); // Create the EnterKey menu, a menu designed for reading an input
    input.Init(Menu.GetCurrentMenu(), self); // Call its custom Init() method
    input.ActivateMenu(); // Set it as the current menu

    return true;
}