We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6163fa7 commit b0df1daCopy full SHA for b0df1da
src/content/docs/config/widgets.md
@@ -393,17 +393,21 @@ subclass of [Gtk.Menu](https://gjs-docs.gnome.org/gtk30~3.0/gtk.menu)
393
| on-move-scroll | `(scroll_type: Gtk.ScrollType) => void` |
394
395
```js
396
-// to have a menu popup on click
397
-const button = Widget.Button({
398
- child: Widget.Label('click to open menu'),
399
- onPrimaryClick: (_, event) => Widget.Menu({
+function RightClickMenu() {
+ const menu = Widget.Menu({
400
children: [
401
Widget.MenuItem({
402
child: Widget.Label('hello'),
403
}),
404
],
405
- }).popup_at_pointer(event),
406
-})
+ })
+
+ return Widget.Button({
+ on_primary_click: (_, event) => {
407
+ menu.popup_at_pointer(event)
408
+ },
409
410
+}
411
```
412
413
### MenuItem
0 commit comments