Possible bug when getting MenuItem.Title

Discuss GUI programming with the RapaGUI plugin here
Post Reply
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Possible bug when getting MenuItem.Title

Post by mrupp »

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:
  • 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)
Check out this example:

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
Forever
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:
Image Image

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:
Image Image

Cheers,
Michael
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Possible bug when getting MenuItem.Title

Post by airsoftsoftwair »

Yes, looks like a bug. I'll check.
Post Reply