News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Incredible Menu Bug

Started by Biterider, October 31, 2024, 04:52:15 AM

Previous topic - Next topic

Biterider

Hi
Today I came across a bug in a so basic windows component that I can't belive that it is true.
The issue arises when using the traditional GDI API to create an owner-draw menu and applying the MFT_RIGHTJUSTIFY flag to items other than the last one.

The official description for this flag on the Microsoft page is as follows:
QuoteRight-justifies the menu item and any subsequent items. This value is valid only if the menu item is in a menu bar.
I built a vanilla application using an RC file containing a menu resource with long names and many items on the menu bar to demonstrate this. In the middle (ItemItemItem3), I added the MFT_RIGHTJUSTIFY flag. 

Once the application shows up, some items are just missing and while it is shrunken, more right-aligned items disappear completely on the left edge. Without the MFT_RIGHTJUSTIFY flag, all works nicely.
I tested it on Win10 and Win8.

Attached is the binary

Biterider




zedd151

Here is an example where if a menu item is right justified, the following menu item is also right justified.




RC Menu:
600 MENUEX
BEGIN
  POPUP "File"
  BEGIN
    MENUITEM "Exit",1000
  END
  POPUP "Help1",,0x00004000
  BEGIN
    MENUITEM "About",1900
  END
  POPUP "Help2"
  BEGIN
    MENUITEM "About",1900
  END
END
WHere "0x00004000" represents right justify.
"Help1" is right justified, the following menu item "Hepl2" is also right justified on the menu, but not via rc file options.
The resource file generated by Ketil Olsens ResEd.

I havent looked up what "0x00004000" is an equate for... I just know it works.  :biggrin:
:biggrin:

zedd151

And another one, Biterider, using your menu items...  :smiley:
Maximize widow to see the effect, if necessary



I an running Wondows 7 and using the binaries in masm32 sdk if that matters.
What version of RC.exe are you using? That may be the culprit... try a different version, maybe?


:biggrin:

Biterider

Hi zedd
I ran your "PlainGui2.exe" and after shrinking it, it shows the same odd behaviour.



Biterider


zedd151

Maybe a "Metro Interface" issue?

Seems it is happening on Windows 10 and Windows 8 but not on Windows 7.  <--  see post below, same issue there.
I had considered that as a possibility while I was out walking the dogs.

Lemme go inside and run your executable, I had not done that before. I'll let you know the results from Windows 7...
:biggrin:

zedd151

Your executable seems fine on Windows 7... until narrowing the width...
Is that what you are referring to? When maximized, it displays the menu fine.

small window
You cannot view this attachment.

larger window
You cannot view this attachment.

Maybe set the window size maximum upon creation, and disable resizing it?  Or simply use shorter menu names?  :tongue:
:biggrin:

Biterider

Hi zedd
Thanks for testing  :thumbsup:
In the meantime I resurrected a Win7 machine too and ran both binaries. The result is identical for both.
I think we are facing a very old bug. 
My testing shows that if only the last menu item is right aligned, everything works fine. Setting any other item to right-aligned triggers the bug.

I'm tempted to report this issue to Microsoft. 
I did it some years ago, but have no idea how it is done these days.

Biterider

zedd151

Quote from: Biterider on October 31, 2024, 06:01:18 AMif only the last menu item is right aligned, everything works fine. Setting any other item to right-aligned triggers the bug.
Have you tried right aligning everything (in the rc menu) after the first right aligned entry??

I just tried right aligning each of the menu items after the explicitly right aligned menu item (in the rc menu), same results.  :sad:

Perhaps there is a reason why many times menu item names are short? I.E., "File", "Edit", "Build", "Help", "About", etc.    :winking:
:biggrin:

BugCatcher


zedd151

Of course BugCatcher, thank you.   :biggrin:
That was my presumption.   :smiley:
:biggrin:

Biterider

Hi
I filed the bugreport to Microsoft using the Feedback-Hub. 
Let's see what happens...

Biterider

zedd151

@Biterider
Let us know what their response is, if and when they do.  :thumbsup:

P.S. don't tell them you are an assembly programmer.  :tongue:  I get the feeling that they shun us assembly coders. Tell them you work in Visual C++ or C#.net  :badgrin:

The last part only half joking, btw,
:biggrin: