A popup context menu (fl_menu), built on DScrollPanel.
Create it, add entries with add_option and add_spacer, then call open to show it at
the cursor or at a given position. It is registered with Derma's menu system, so it is
removed when the Derma menus are closed. The action menu of an item is built with it.
Summary
Methods
Methods
Adds a clickable option to the bottom of the menu.
local item_menu = vgui.Create('fl_menu')
local use_button = item_menu:add_option(t(item_obj:get_use_text()), function()
item_obj:do_menu_action('on_use')
end)
use_button:SetIcon(item_obj.use_icon or 'icon16/accept.png')
item_menu:open()
Parameters
- name String text of the option
- callback Function optional, defaults to
nilcalled with the option's panel when it is clicked
Returns
- Panel the created fl_menu_item
Adds a thin horizontal divider below the last option.
Parameters
- px Number optional, defaults to
1height of the divider in pixels
Returns
- Panel the created divider
Tells the Derma menu system to remove this menu when menus are closed.
Returns
- Boolean always true
Starts the menu with the padding that its options are inset by.
Opens the menu as a popup at the given screen position and registers it to be closed together with other Derma menus.
Parameters
- x Number optional, defaults to
gui.MouseX() - y Number optional, defaults to
gui.MouseY()
Returns
- Panel the menu itself
Draws the card of the menu.
Parameters
- w Number panel width
- h Number panel height
Makes the menu and all of its options as wide as the widest option and as tall as the options combined, capped at 75% of the screen height.