The height of this element, in UI coordinate space.
The percentage height of the screen this element should take up when sizeMode is set to LayoutMode.PROPORTIONAL. The number needs to be a decimal.
OptionallabelThe string label to display alongside the input textbox.
-- Create new container
local newWindow = osrs.Ui.window({title = "Example Window"})
-- Create an Input Text UI element with the label "Test"
local exampleInput = osrs.Ui.inputText({label = "Test"})
-- Add a Input Text UI element to the container
newWindow:addChild(exampleInput)
-- Add container to the canvas
osrs.Ui.canvas:addChild(newWindow)
The max size of the input to the textbox.
-- Create new container
local newWindow = osrs.Ui.window({title = "Example Window"})
-- Create an Input Text UI element with the max size of 2
local exampleInput = osrs.Ui.inputText({maxSize = 2})
-- Add a Input Text UI element to the container
newWindow:addChild(exampleInput)
-- Add container to the canvas, see how the max size is now only 2
osrs.Ui.canvas:addChild(newWindow)
Flag to indicate if the input text should support multiple lines and enables Sizing. To swap to a new line in the input text you need to hit Ctrl Enter
-- Create new container
local newWindow = osrs.Ui.window({title = "Example Window"})
-- Create an Input Text UI element with multiline set to true
local exampleInput = osrs.Ui.inputText({multiline = true})
-- Add a Input Text UI element to the container
newWindow:addChild(exampleInput)
-- Add container to the canvas
osrs.Ui.canvas:addChild(newWindow)
The callback that is called when the user presses the enter button in an input textbox.
-- Create new container
local newWindow = osrs.Ui.window({title = "Example Window"})
-- Create an Input Text UI element with an onEnter function
local exampleInput = osrs.Ui.inputText(
{
onEnter = function()
osrs.print("Hit Enter!")
end
}
)
-- Add a Input Text UI element to the container
newWindow:addChild(exampleInput)
-- Add container to the canvas
osrs.Ui.canvas:addChild(newWindow)
OptionalonThe function callback invoked when the element's value is changed.
-- Create new container
local newWindow = osrs.Ui.window({title = "Example Window"})
-- Create a new dropdown menu with a change function
local menu = osrs.Ui.dropdown(
{
label = "Test",
values = {"Test1", "Test2", "Test3"},
onValueChange = function()
osrs.print("Change")
end
}
)
-- Add dropdown to the container
newWindow:addChild(menu)
-- Add container to the canvas
osrs.Ui.canvas:addChild(newWindow)
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)
How this element should size itself.
-- Create a window that has automatic size mode, this is default
local window1 = osrs.Ui.window({title = "Automatic Size Mode"})
-- Create a window that has manual size mode
local window2 = osrs.Ui.window(
{
title = "Manual Size Mode",
sizeMode = osrs.Ui.LayoutMode.MANUAL,
height = 200,
width = 200
}
)
-- Add the windows to the canvas
osrs.Ui.canvas:addChild(window1)
osrs.Ui.canvas:addChild(window2)
The style, if any, that should be applied to this element.
String to display to the user when hovered over the element.
-- Create new container
local newWindow = osrs.Ui.window({title = "Example Window"})
-- Create a button with a tooltip
local button = osrs.Ui.textButton({text = "Test", tooltip = "This is a Tooltip!"})
-- Add slider to the container
newWindow:addChild(button)
-- Add container to the canvas
osrs.Ui.canvas:addChild(newWindow)
The current text entered into the input textbox. Is writable, and may be modified by script.
-- Create new container
local newWindow = osrs.Ui.window({title = "Example Window"})
-- Create an Input Text UI element with a set value of "hello!"
local exampleInput = osrs.Ui.inputText({value = "hello!"})
-- Add a Input Text UI element to the container
newWindow:addChild(exampleInput)
-- Add container to the canvas
osrs.Ui.canvas:addChild(newWindow)
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 width of this element, in UI coordinate space.
The percentage width of the screen this element should take up when sizeMode is set to LayoutMode.PROPORTIONAL. The number needs to be a decimal.
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.
Adds a UI element to the pop up container.
Imgui element to add to the pop up menu
local button = osrs.Ui.textButton( { text="Clear", tooltip="Test" })
local selectable = osrs.Ui.selectable({text = "Example", onClick = function() osrs.print("Example Print") end}) clear:addPopUpElement(test) osrs.Ui.leftPanel:addChild(button)
Removes a UI element from the pop up container.
Imgui element to remove from the pop up menu.
local button = osrs.Ui.textButton( { text="Clear", tooltip="Test" })
local selectable = osrs.Ui.selectable({text = "Example", onClick = function() osrs.print("Example Print") end}) clear:addPopUpElement(test) clear:removePopUpElement(test) osrs.Ui.leftPanel:addChild(button)
A UI element with a user-enterable text field. Sizing is only enabled when multiline mode is turned on.