5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 17:42:24 +08:00
wails/v3/examples/contextmenus
Lea Anthony 3d88bf8795
Fix context menu issues.
Fix WindowID for requests on windows.
Add `Windows.ApplicationStarted` event
2023-10-10 21:48:47 +11:00
..
assets [v3] Fix examples background color (#2750) 2023-07-01 10:55:10 +10:00
main.go Fix context menu issues. 2023-10-10 21:48:47 +11:00
README.md Fix context menu issues. 2023-10-10 21:48:47 +11:00

contextmenus

This example shows how to create a context menu for your application. It demonstrates window level and global context menus.

A simple menu is registered with the window and the application with the id "test". In our frontend html, we then use the --custom-contextmenu style to attach the menu to an element. We also use the --custom-contextmenu-data style to pass data to the menu callback which can be read in Go. This is really useful when using components to distinguish between different elements.


```html

<div class="region" id="123abc" style="--custom-contextmenu: test; --custom-contextmenu-data: 1">
    <h1>1</h1>
</div>
<div class="region" id="234abc" style="--custom-contextmenu: test; --custom-contextmenu-data: 2">
    <h1>2</h1>
</div>

Status

Platform Status
Mac
Windows Working
Linux

TODO

  • Windows: Fix crash for custom context menu