Skip to content

Commit

Permalink
Updated README to include a better example that includes on click events
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouri028 committed Oct 8, 2023
1 parent bbc2d51 commit 88f4c53
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,22 @@ fn main() {
'${@VMODROOT}/assets/icon.ico'
}
mut tray := vtray.create(icon, tooltip: 'VTray Demo!')
tray.add_item('Edit', checkable: true)
tray.add_item('Copy', disabled: true)
tray.add_item('Edit',
checkable: true
on_click: fn [tray] (item &vtray.MenuItem) {
println(item)
if item.checked {
tray.set_icon('${@VMODROOT}/assets/test.ico')
} else {
tray.set_icon('${@VMODROOT}/assets/icon.ico')
}
}
)
tray.add_item('Copy',
on_click: fn [tray] () {
tray.set_tooltip('Copied!')
}
)
tray.add_item('Quit', on_click: tray.destroy)
tray.run()
tray.destroy()
Expand Down

0 comments on commit 88f4c53

Please sign in to comment.