Possible bug when getting MenuItem.Title
Posted: Wed Feb 09, 2022 11:08 pm
Hi there
Quite a strange one: getting the title of a MenuItem with a shortcut corrupts the title. This happens with MUI only, but with all MUI versions that I tested:
The example is very simple, it gets the title from each MenuItem and outputs them to the textview, that's all.
This works perfectly well on Windows and macOS, the menu stays intact:

Not so with MUI, after clicking the button, the menu titles are returned as empty string and the titles are corrupted, but only on items that have a shortcut:

Cheers,
Michael
Quite a strange one: getting the title of a MenuItem with a shortcut corrupts the title. This happens with MUI only, but with all MUI versions that I tested:
- AmigaOS 3.9 mit MUI 3.9
- AmigaOS 4.1 FEu2 with MUI 5.0 (20210831)
- MorphOS with MUI 5 22.3 (30.12.20)
Code: Select all
@REQUIRE "RapaGUI", {Link = True}
@APPTITLE "MenuItems-Test"
Function p_EventFunc(msg)
; DebugPrint(msg.id)
Switch msg.Class
Case "Button":
Local text$ = ""
For Local i = 1 To 4
text$ = text$ .. moai.Get("men" .. i, "title") .. "\n"
Next
moai.Set("ctrlLog", "text", text$)
EndSwitch
EndFunction
moai.CreateApp([[<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
<menubar id="ctrlMenubar">
<menu id="menStatic" title="Menu">
<item id="men1" shortcut="Ctrl+1">Item 1</item>
<item id="men2">Item 2</item>
<item id="men3" shortcut="Ctrl+3">Item 3</item>
<item id="men4">Item 4</item>
</menu>
</menubar>
<window id="mainWindow" menubar="ctrlMenubar" height="200" title="MenuItems-Test">
<vgroup id="mainGroup">
<hgroup>
<button id="btnRead">Read MenuItem titles</button>
</hgroup>
<textview id="ctrlLog" />
</vgroup>
</window>
</application>]])
InstallEventHandler({RapaGUI = p_EventFunc})
Repeat
WaitEvent
ForeverThis works perfectly well on Windows and macOS, the menu stays intact:

Not so with MUI, after clicking the button, the menu titles are returned as empty string and the titles are corrupted, but only on items that have a shortcut:

Cheers,
Michael