Menus

Updated for version 3.36.

All values and functions are inherited from here: https://luffyyy.gitbook.io/beardlib/menuui/menuui-item

Holder

The most simple type of menu. Only holds items. If you don't need a scroll-able panel you should use this menu type instead of Menu.

Creation

MyRandomMenu:Holder({
    name = "Holdon"
})

Parameters

ParameterTypeDescription

auto_height

Boolean

Should the menu automatically set the height based on items it has? Defaults to true

A Menu is a menu type with a scroll-able panel for the items.

Creation

MyRandomMenu:Menu({
    name = "Menu"
})

Parameters

ParameterTypeDescription

scrollbar

Boolean

Should there by a scrollbar for the menu? You should set this to false if you are sure the menu will never have too many items to require a scrollbar. Defaults to true if the menu has auto_height set to false or min_height not set to null or max_height not set to null (Recommended to use Holder instead in that case)

scroll_width

Number

Set a custom size for the scrollbar. Defaults to 8

auto_height

Boolean

Should the menu automatically set the height based on items it has? Defaults to true if menu is a group

Functions

Get

FunctionReturn TypeDescription

ScrollY()

Number

Returns the current scroll Y position. Useful if you want to retain the position of the scroll

Set

FunctionDescription

SetScrollSpeed(Number speed)

Sets the scrolling speed

SetSize(Number w, Number h)

Sets the size for the menu. w is the width and h is the height w and h can be null and will default to the current size if not defined

SetScrollY(Number y)

Sets the Y position of the scroll

Group/DivGroup

Inherits Menu

Features a title and a scroll-able panel for items. Additionally allows you to close and open the menu.

Creation

MyRandomMenu:Group({
    name = "2ndMenu",
    text = "A group!"
})

or if a DivGroup:

MyRandomMenu:DivGroup({
    name = "3rdMenu",
    text = "Div group!"
})

DivGroup

The difference between Group and DivGroup is that div group sets divider_type to true which makes the item like a divider but it has items, this also disables toggling for the group.

Parameters

ParameterTypeDescription

closed

Boolean

is the group closed?

Functions

FunctionDescription

ToggleGroup()

Toggles the group, if it's closed then it will open it and if not it will close it

CloseGroup()

Closes the group

OpenGroup()

Opens the group

PopupMenu

A menu that is like a simple button. But, opens up a popup menu when pressed. Kind of like those context menus in every Windows app.

Creation

MyRandomMenu:PopupMenu({
    name = "ooo",
    text = "File"
})

Parameters

ParameterTypeDescription

keep_menu_open

Boolean

Decides whether the popup menu should stay open after pressing outside of it. Defaults to false

Functions

FunctionDescription

Open()

Opens the menu

Close()

Closes the menu

NoteBook

Inherits Menu A menu that is like a notebook; it has pages. You can control the page using the arrow keys at the top right corner of the menu.

Creation

local nb = MyRandomMenu:NoteBook({
    name = "NoteBook",
    text = "My book..."
})
local item = nb:Button({
    text = "Dummy button"
})
--Create a page and inserts the item into it.
nb:AddItemPage(item)

This is a little weird type of item, it has items; but only renders them based on pages. So be careful with it.

Parameters

ParameterTypeDescription

page

Number

The current page. Defaults to 1

Functions

Get

FunctionReturn TypeDescription

GetCurrentPage()

Number

Returns the current page

GetPageCount()

Number

Returns the page count

GetItemPage(Item item)

Table

Returns the page of an item; if it's inside any

Set

FunctionDescription

SetPage(Number page)

Sets the current page

Other

FunctionDescription

AddToPage(Item item, Number page)

Adds an item to a page

RemoveFromPage(Item item, Number page)

Removes an item from a page

AddPage(String name, Number indx)

Adds a page. name is the name of the page. It will also be displayed near the arrow page controls. indx is used to insert it to a specific index. By default it inserts it to the last position

AddItemPage(String name, Item item, Number indx)

Adds a page by the name of name and adds item to it. indx is same as in AddPage

SetPageName(Number indx, String name)

Sets a page name/title. indx is the page number and name is the title

RemovePage(Number indx)

Removes a page that has the index indx

RemoveAllPages()

Removes all pages

RemovePageWithItem(Item item)

Removes a page that has a certain item

Last updated