Files
Basalt/docs/docs1_6/objects/Menubar.md
Robert Jelic d4c72514ef Docs 1.6
Accidentally uploaded outdated 1.6 docs
2023-05-01 16:28:46 +02:00

1.7 KiB

Menubars are like lists but instead of being vertical, they are horizontal. Imagine you are creating a Operating System and you would like to add a taskbar, menubars would be exactly what you need, because they are also scrollable, which means they can have endless entries.

Object methods also apply for menubars.

addItem Adds a new item into the list
removeItem Removes a item from the list
editItem Changes a already existing item in the list
getItem Returns a item by its index
getItemCount Returns the item count
getAll Returns the entire list as a table
selectItem Selects a item
clear Makes the entire list empty
getItemIndex Returns the currently active item index
setSelectedItem Changes the default bg and fg, when the user selects a item
setOffset Changes the list offset
getOffset Returns the current offset
setScrollable Makes the list scrollable
setSpace Adds space between the entries

A item-table in menubars looks like the following example:

item = {
  text="1. Entry",  -- the text its showing
  bgCol=colors.black,  -- the background color
  fgCol=colors.white -- the foreground color
  args = {} -- custom args you want to pass, which you will be able to access in for example onChange events
}