This event is fired only if a notification icon has been previously loaded with Window.loadtrayicon().
Window:onTrayClick( ) event
This event is fired when the user has clicked 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
local win = ui.Window("Window.onTrayClick() sample", 320, 200)
local button = ui.Button(win, "Click me to quit !")
button:center()
win:status("Close the Window to show the notify icon")
local canexit = false
-- event fired when notification icon is clicked
function win:onTrayClick()
-- removes the notification icon
self:loadtrayicon()
-- shows the window
win:show()
end
-- event fired when the window close button is clicked
function win:onClose()
-- loads and display a notification icon in the tray
win:loadtrayicon(sys.env.WINDIR.."/system32/shell32.dll", 28)
-- then hides the window
self:hide()
-- and set the notification icon tooltip
win.traytooltip = "click me to show the window again"
-- dont close the window after this event
return false
end
win:show()
-- button:onClick() event (to quit)
function button:onClick()
canexit = true
end
-- update user interface
repeat
ui.update()
until canexit