LuaRT icon indicating copy to clipboard operation
LuaRT copied to clipboard

`Panel:onKey()` and `Tab:onKey()` events are not documented

Open samyeyo opened this issue 1 year ago • 2 comments

Panel and Tab widgets supports onKey() event but it's not documented

samyeyo avatar Mar 07 '24 13:03 samyeyo

Panel and Tab widgets supports onKey() event but it's not documented

Are you sure about that? I tried the onKey event, but it doesn't work.

code:


local ui = require "ui"

local win = ui.Window("test", 320, 200)
Tab = ui.Tab(win, {"1", "1"}, 100, 100, 100, 100)
Tab:center()

function Tab:onKey(key)
	win:status("Pressed Key : "..key)
end 

win:show() 

while win.visible do 
	ui.update()
end
            

local ui = require "ui"

local win = ui.Window("test", 320, 200)
Panel = ui.Panel(win, 100, 100, 100, 100)
Panel:center()

function Panel:onKey(key)
	win:status("Pressed Key : "..key)
end 

win:show() 

while win.visible do 
	ui.update()
end
            

Adem-Kurt avatar Dec 14 '24 20:12 Adem-Kurt

There is an issue with this. Panel:onKey() is fixed for next LuaRT release, but I will remove the Tab:onKey() event as it won't work as expected

samyeyo avatar Dec 16 '24 07:12 samyeyo