Skip to main content

Window

Windows are the fundamental widget for Iris. Every other widget must be a descendant of a window.

Iris.Window({ "Example Window" })
    Iris.Text({ "This is an example window!" })
Iris.End()

Example window

If you do not want the code inside a window to run unless it is open then you can use the following:

local window = Iris.Window({ "Many Widgets Window" })

if window.state.isOpened.value and window.state.isUncollapsed.value then
    Iris.Text({ "I will only be created when the window is open." })
end
Iris.End() -- must always call Iris.End(), regardless of whether the window is open or not.

Properties

Window

WidgetHasChildrenHasState
Window.Window: Iris.Window

The top-level container for all other widgets to be created within. Can be moved and resized across the screen. Cannot contain embedded windows. Menus can be appended to windows creating a menubar.

hasChildren = true
hasState = true
Arguments = {
    Title: string,
    NoTitleBar: boolean? = false,
    NoBackground: boolean? = false, -- the background behind the widget container.
    NoCollapse: boolean? = false,
    NoClose: boolean? = false,
    NoMove: boolean? = false,
    NoScrollbar: boolean? = false, -- the scrollbar if the window is too short for all widgets.
    NoResize: boolean? = false,
    NoNav: boolean? = false, -- unimplemented.
    NoMenu: boolean? -- whether the menubar will show if created.
}
Events = {
    opened: () -> boolean, -- once when opened.
    closed: () -> boolean, -- once when closed.
    collapsed: () -> boolean, -- once when collapsed.
    uncollapsed: () -> boolean, -- once when uncollapsed.
    hovered: () -> boolean -- fires when the mouse hovers over any of the window.
}
States = {
    size = State<Vector2>? = Vector2.new(400, 300),
    position = State<Vector2>?,
    isUncollapsed = State<boolean>? = true,
    isOpened = State<boolean>? = true,
    scrollDistance = State<number>? -- vertical scroll distance, if too short.
}

Tooltip

Widget
Window.Tooltip: Iris.Tooltip

Displays a text label next to the cursor

Iris.Tooltip({"My custom tooltip"})

Basic tooltip example

hasChildren = false
hasState = false
Arguments = {
    Text: string
}
Show raw api
{
    "functions": [],
    "properties": [
        {
            "name": "Window",
            "desc": "The top-level container for all other widgets to be created within.\nCan be moved and resized across the screen. Cannot contain embedded windows.\nMenus can be appended to windows creating a menubar.\n\n```lua\nhasChildren = true\nhasState = true\nArguments = {\n    Title: string,\n    NoTitleBar: boolean? = false,\n    NoBackground: boolean? = false, -- the background behind the widget container.\n    NoCollapse: boolean? = false,\n    NoClose: boolean? = false,\n    NoMove: boolean? = false,\n    NoScrollbar: boolean? = false, -- the scrollbar if the window is too short for all widgets.\n    NoResize: boolean? = false,\n    NoNav: boolean? = false, -- unimplemented.\n    NoMenu: boolean? -- whether the menubar will show if created.\n}\nEvents = {\n    opened: () -> boolean, -- once when opened.\n    closed: () -> boolean, -- once when closed.\n    collapsed: () -> boolean, -- once when collapsed.\n    uncollapsed: () -> boolean, -- once when uncollapsed.\n    hovered: () -> boolean -- fires when the mouse hovers over any of the window.\n}\nStates = {\n    size = State<Vector2>? = Vector2.new(400, 300),\n    position = State<Vector2>?,\n    isUncollapsed = State<boolean>? = true,\n    isOpened = State<boolean>? = true,\n    scrollDistance = State<number>? -- vertical scroll distance, if too short.\n}\n```\n    ",
            "lua_type": "Iris.Window",
            "tags": [
                "Widget",
                "HasChildren",
                "HasState"
            ],
            "source": {
                "line": 82,
                "path": "lib/API.lua"
            }
        },
        {
            "name": "Tooltip",
            "desc": "Displays a text label next to the cursor\n\n```lua\nIris.Tooltip({\"My custom tooltip\"})\n```\n\n![Basic tooltip example](../assets/basicTooltip.png)\n\n```lua\nhasChildren = false\nhasState = false\nArguments = {\n    Text: string\n}\n```\n    ",
            "lua_type": "Iris.Tooltip",
            "tags": [
                "Widget"
            ],
            "source": {
                "line": 114,
                "path": "lib/API.lua"
            }
        }
    ],
    "types": [],
    "name": "Window",
    "desc": "Windows are the fundamental widget for Iris. Every other widget must be a descendant of a window.\n\n```lua\nIris.Window({ \"Example Window\" })\n    Iris.Text({ \"This is an example window!\" })\nIris.End()\n```\n\n![Example window](../assets/basicWindow.png)\n\nIf you do not want the code inside a window to run unless it is open then you can use the following:\n```lua\nlocal window = Iris.Window({ \"Many Widgets Window\" })\n\nif window.state.isOpened.value and window.state.isUncollapsed.value then\n    Iris.Text({ \"I will only be created when the window is open.\" })\nend\nIris.End() -- must always call Iris.End(), regardless of whether the window is open or not.\n```\n    ",
    "source": {
        "line": 39,
        "path": "lib/API.lua"
    }
}