Page 1 of 1

Small docs improvement concerning MenuItems

Posted: Sun Mar 03, 2024 1:36 pm
by mrupp
Hi there

For my application, I'm implementing context menus. So I was following the example described here:
Chapter 3.16: https://www.hollywood-mal.com/docs/html ... Menus.html

Code: Select all

<menu title="Context menu" id="ctxtmenu">
   <item>Cut</item>
   <item>Copy</item>
   <item>Paste</item>
</menu>

<window>
...
   <texteditor contextmenu="ctxtmenu"/>
...
</window>
But I was wondering why I didn't receive any notifications when clicking a menuitem. I added the notify="selected" attribute and then it was working. Still, the docs clearly say that this should not be necessary, and that got me puzzled.

Only a day later I realized my very silly mistake: The notifications (without stating notify="selected") work as soon as the menuitems have IDs, which of course makes totally sense.

Still, it might save some time to others (as it would have for me) to change the example above to the following:

Code: Select all

<menu title="Context menu" id="ctxtmenu">
   <item id="mni_cut">Cut</item>
   <item id="mni_copy">Copy</item>
   <item id="mni_paste">Paste</item>
</menu>

<window>
...
   <texteditor contextmenu="ctxtmenu"/>
...
</window>
(or similar)

The same example can also be found here:
Chapter 30.1: https://www.hollywood-mal.com/docs/html ... /Menu.html

Cheers,
Michael

Re: Small docs improvement concerning MenuItems

Posted: Tue Mar 05, 2024 10:40 pm
by airsoftsoftwair
mrupp wrote: Sun Mar 03, 2024 1:36 pm Still, it might save some time to others (as it would have for me) to change the example above to the following:
Yes, makes sense, I've just changed that.