Class: Widget
Lua
C++
Edit

Widget:SetColor

This method sets a widget's color value.

Syntax

Parameter Description
r red component of the color to set
g green component of the color to set
b blue component of the color to set
a alpha component of the color to set
color color to set
index color index

Remarks

The color index can be any of the following values:

Example

-- Get the displays
local displays = GetDisplays()

-- Create a window
local window = CreateWindow("Ultra Engine", 0, 0, 800, 600, displays[1])

-- Create User Interface
local ui = CreateInterface(window)
local sz = ui.background:ClientSize()

-- Create widget
local panel = CreatePanel(50, 50, sz.x - 100, sz.y - 100, ui.background)

-- Fade to black over ten seconds
panel:SetColor(0, 0, 1, 1, WIDGETCOLOR_BACKGROUND)

while true do
    local ev = WaitEvent()
    if ev.id == EVENT_WINDOWCLOSE then
        return 0
    end
end
Copyright © 2024 Ultra Software.
All rights reserved.