Panel:tofront( widget ) method
Brings the current Panel in front of all other wudgets, or in front of the specified widget.
Parameters
widget
The widget above which the current Panel will be.
Return value
This function returns no value.Example
local ui = require "ui"
-- create a fixed Window
local win = ui.Window("Panel:toback() sample", "fixed", 320, 200)
-- create a Panel
local panel1 = ui.Panel(win, 0, 0, 100, 100)
panel1.bgcolor = 0xF0A000
panel1:center()
local panel2 = ui.Panel(win, 0, 0, 100, 100)
panel2.bgcolor = 0x00a0F0
panel2.x = panel1.x + 12
panel2.y = panel1.y - 10
async(function()
while true do
panel2:tofront(panel1)
sleep(1000)
panel1:tofront(panel2)
sleep(1000)
end
end)
ui.run(win):wait()