accelerators for any event + more inspect examples

This commit is contained in:
kepler155c@gmail.com
2019-11-13 21:50:00 -07:00
parent db48031c7c
commit 3241326a2f
10 changed files with 140 additions and 14 deletions

View File

@@ -90,3 +90,28 @@ function UI.Notification:eventHandler(event)
end
end
end
function UI.Notification.example()
return UI.Window {
notify = UI.Notification {
anchor = 'top',
},
button1 = UI.Button {
x = 2, y = 3,
text = 'success',
event = 'test_success',
},
button2 = UI.Button {
x = 2, y = 5,
text = 'error',
event = 'test_error',
},
eventHandler = function (self, event)
if event.type == 'test_success' then
self.notify:success('Example text')
elseif event.type == 'test_error' then
self.notify:error('Example text')
end
end,
}
end