How this element should position itself.
-- Create a window that has automatic position mode, this is default
local window1 = osrs.Ui.window({title = "Automatic Position Mode"})
-- Create a window that has manual position mode
local window2 = osrs.Ui.window(
{
title = "Manual Position Mode",
positionMode = osrs.Ui.LayoutMode.MANUAL
}
)
-- Add the windows to the canvas
osrs.Ui.canvas:addChild(window1)
osrs.Ui.canvas:addChild(window2)
Flag to control whether this element should be placed on the same line as the previous element.
-- Create a container
local window = osrs.Ui.window({title = "Example Window"})
-- Create three buttons, with two of them on the same line
local button1 = osrs.Ui.textButton({text = "Button 1"})
local button2 = osrs.Ui.textButton({text = "Button 2"})
local button3 = osrs.Ui.textButton({text = "Button 3", sameLine = true})
-- Add buttons to the container
window:addChild(button1)
window:addChild(button2)
window:addChild(button3)
-- Add container to the canvas
osrs.Ui.canvas:addChild(window)
The style, if any, that should be applied to this element.
Boolean indicating whether this UI element should draw itself.
-- Create new container
local newWindow = osrs.Ui.window({title = "Example Window"})
-- Create a button that is renderable, and one that is not
local button1 = osrs.Ui.textButton(
{
text = "Peek-a-Boo",
visible = false,
onClick = function()
osrs.print("BOO!")
end
}
)
local button2 = osrs.Ui.textButton(
{
text = "Render",
onClick = function()
button1.visible = not button1.visible
end
}
)
-- Add buttons to the container
newWindow:addChild(button1)
newWindow:addChild(button2)
-- Add container to the canvas
osrs.Ui.canvas:addChild(newWindow)
The horizontal component of this element's position, in UI coordinate space.
The percentage distance from the left side of the screen that this element's top-left corner should be placed at when positionMode is set to LayoutMode.PROPORTIONAL. The number needs to be a decimal.
The vertical component of this element's position, in UI coordinate space.
The percentage distance from the top side of the screen that this element's top-left corner should be placed at when positionMode is set to LayoutMode.PROPORTIONAL. The number needs to be a decimal.
Add a new tab element to the container.
The string displayed in the newly added tab.
-- Create a container
local window = osrs.Ui.window({title = "Example Window"})
-- Create a tab box
local tabBox = osrs.Ui.tabBox()
-- Add a tab to the tab box
tabBox:addTab("Tab 1")
-- Add the tab box to the container
window:addChild(tabBox)
-- Add the container to the canvas
osrs.Ui.canvas:addChild(window)
Adds an imgui element to the specified tab, if a tab at that index exists. Logs an error if the index is out of bounds and early exits.
Index of the tab to add the element to.
Imgui element to add to the tab.
-- Create a container
local window = osrs.Ui.window({title = "Example Window"})
-- Create a tab box
local tabBox = osrs.Ui.tabBox()
-- Add tabs to the tab box
tabBox:addTab("Tab 1")
tabBox:addTab("Tab 2")
-- Create and add a button to tab 2
local button = osrs.Ui.textButton({text = "Button"})
tabBox:addTabChild(2, button)
-- Add the tab box to the container
window:addChild(tabBox)
-- Add the container to the canvas
osrs.Ui.canvas:addChild(window)
Get the number of tabs currently in the container.
Count of tabs maintained by this element.
Adds a name to an existing tab. Logs an error if the index is out of bounds and early exits.
index of the tab to label.
string to display in as the tab title.
-- Create a container
local window = osrs.Ui.window({title = "Example Window"})
-- Create a tab box
local tabBox = osrs.Ui.tabBox()
-- Add a tab to the tab box
tabBox:addTab()
-- Change the name of the new tab
tabBox:labelTab(1, "Tab 1")
-- Add the tab box to the container
window:addChild(tabBox)
-- Add the container to the canvas
osrs.Ui.canvas:addChild(window)
Removes the specified tab from the container. All other tabs move up by one. Logs an error if the index is out of bounds and early exits.
Index of the tab to remove from the tab group.
-- Create a container
local window = osrs.Ui.window({title = "Example Window"})
-- Create a tab box
local tabBox = osrs.Ui.tabBox()
-- Add tabs to the tab box
tabBox:addTab("Tab 1")
tabBox:addTab("Tab 2")
tabBox:addTab("Tab 3")
-- Remove the second tab from the tab box
tabBox:removeTab(2)
-- Add the tab box to the container
window:addChild(tabBox)
-- Add the container to the canvas
osrs.Ui.canvas:addChild(window)
Removes the specified imgui element in the specified tab, if it exists. If an imgui element is not provided, removes the last element in the specified tab element. Logs an error if the index is out of bounds and early exits.
Index of the tab to remove an element from.
Imgui element to remove from the tab.
A UI element that contains multiple panes as children and displays only the active pane, navigatable through labeled tabs.