This event is fired only if a notification icon has been previously loaded with Window.loadtrayicon().
Window:onTrayContext( ) event
This event is fired when the user right-click on the notification icon of the window, in the tray section of the taskbar
Return value
The event returns no value.Example
local ui = require "ui"
-- create a simple Window
-- that will stay hidden
local win = ui.Window("Window.onTrayHover() sample", 320, 200)
win:loadtrayicon(sys.env.WINDIR.."/system32/shell32.dll", 44)
-- create the popup menu
local menu = ui.Menu("Exit")
local canexit = false
-- onClick event for first item menu "Exit"
menu.items[1].onClick = function ()
canexit = true
end
-- Shows the menu on notification icon right-click
function win:onTrayContext()
self:popup(menu)
end
-- Click on the notification icon to exit program
function win:onTrayClick()
canexit = true
end
-- update user interface
repeat
ui.update()
until canexit