- The color is represented by a number, an RGB value (one byte per primary color).
- A RGB color can be represented as an hexadecimal number : 0xRRGGBB , RR meaning a 8bit hexadecimal red value, and so on.
Edit.bgcolor read/write property
Get or set the global Edit background color.
Example
local ui = require "ui"
-- create a fixed Window to hold the buttons
local win = ui.Window("Edit.bgcolor sample", "fixed", 320, 240)
local label = ui.Label(win, "Enter text : ")
local edit = ui.Edit(win, "Hello LuaRT !", label.x + label.width + 8, label.y-4, 150)
local button = ui.Button(win, "Set bgcolor", edit.x + edit.width + 8, edit.y)
local function update_status()
win:status(string.format("Edit.bgcolor : 0x%06X", edit.bgcolor))
end
function button:onClick()
edit.bgcolor = ui.colordialog()
update_status()
end
update_status()
win:show()
-- update user interface
repeat
ui.update()
until not win.visible