🖼️UIPanel

UIPanel metatable

:__tostring(): nil


:__eq(other: UIPanel): boolean

Overload for operator ==.

Name
Type
Description

other


:FindChild(id: string): UIPanel|nil

Name
Type
Description

id

string

id of the child.

Finds child by name.


:IsVisible(): boolean

Returns visible state.


:SetVisible(newState: boolean): nil

Name
Type
Description

newState

boolean

Sets visible state.


:GetClassList(): string[]

Returns class name list.


:FindChildInLayoutFile(id: string): UIPanel|nil

Name
Type
Description

id

string

???.


:FindPanelInLayoutFile(id: string): UIPanel|nil

Name
Type
Description

id

string

???.


:FindChildTraverse(id: string): UIPanel|nil

Name
Type
Description

id

string

Recursive find child by id.


:GetChildCount(): integer

Returns child by count.


:GetChild(index: number): UIPanel|nil

Name
Type
Description

index

number

Returns child by index.


:GetChildByPath(path: string[], bLogError [?]: boolean): UIPanel|nil

Name
Type
Description

path

string[]

bLogError [?]

boolean

Log error if panel not found. (default: false)

Returns child by path using FindChild.


:GetChildIndex(): integer

Returns index in parent children list. Starts from 0.


:GetFirstChild(): UIPanel|nil

Returns first child.


:GetLastChild(): UIPanel|nil

Returns last child.


:HasID(): boolean

Returns true if the panel has an id.


:GetID(): string

Returns id of panel.


:SetID(id: string): nil

Name
Type
Description

id

string

Sets the panel's id.


:GetLayoutHeight(): integer

Returns the panel height.


:GetLayoutWidth(): integer

Returns the panel width.


:GetParent(): UIPanel|nil

Returns the panel's parent.


:GetRootParent(): UIPanel|nil

Returns the panel's root parent. ???


:GetXOffset(): integer

Returns the panel's relative X offset.


:GetYOffset(): integer

Returns the panel's relative Y offset.


:GetBounds(): {x:number, y:number, w:number, h:number}

Returns the panel's bounds. Iterate over the parent hierarchy to get the absolute bounds.


:GetPanelType(): string

Returns the panel's type.


:BSetProperty(key: string, value: string): boolean

Name
Type
Description

key

string

value

string

Sets the panel property.


:SetStyle(cssString: string): boolean

Name
Type
Description

cssString

string

Sets the panel style.

Example

-- set_style.lua
local css_like_table = {
    ["horizontal-align"] = "center",
	["vertical-align"] = "center",
    ["transform"] = "translate3d( 0px, -0px, 0px ) scale3d(1, 1, 1)",
    ["padding-left"] = "0px",
    ["margin"] = "0px",
    ["border-radius"] = "4px",
    ["background-color"] = "none",
    ["box-shadow"] = "none",
    ["color"] = "gradient( linear, 0% 100%, 0% 0%, from( #ff00FF ), to( #5C9C68 ) )",
    ["font-size"] = "20px",
    ["text-align"] = "center",
    ["text-decoration"] = "none",
    ["background-size"] = "0% 0%",
    ["opacity-mask"] = 'url("s2r://panorama/images/masks/hudchat_mask_psd.vtex") 1.0',
    ["hue-rotation"] = "-10deg",
    ["text-shadow"] = "2px 2px #111111b0",
    ["blur"] = "gaussian(0px)",
    ["line-height"] = "120%",
    ["font-family"] = "Radiance",
    ["border-brush"] = "gradient( linear, 0% 0%, 0% 100%, from( #96c5ff96 ), to( #12142d2d ) )",
}


local function css_to_string(tbl)
    local str = ""
    for k, v in pairs(tbl) do
        str = str .. k .. ": " .. v .. "; "
    end
    return str;
end

local health_label = Panorama.GetPanelByName("HealthLabel");
if (health_label) then
    health_label:SetStyle(css_to_string(css_like_table))
end

:SetAttribute(key: string, value: string): nil

Name
Type
Description

key

string

value

string

Sets the panel's attribute.


:GetAttribute(key: string, default: string): string|nil

Name
Type
Description

key

string

default

string

Returns the panel's attribute.


:GetText(): string

This method is only available for Label panels.

Returns the panel's text.


:SetText(text: string): nil

This method is only available for Label panels.

Name
Type
Description

text

string

Sets the panel's text.


:AddClasses(classNames: string): nil

Name
Type
Description

classNames

string

Could be a space separated list of classes.

Adds a class to the panel.


:RemoveClasses(classNames: string): nil

Name
Type
Description

classNames

string

Could be a space separated list of classes.

Removes a class to the panel.

Last updated