Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSMenu ignores initWithTitle #218

Open
optimisme opened this issue Dec 21, 2023 · 1 comment
Open

NSMenu ignores initWithTitle #218

optimisme opened this issue Dec 21, 2023 · 1 comment
Labels
bug A bug, but not a show stopper

Comments

@optimisme
Copy link

This works:
NSMenuItem *fileMenuItem = [NSMenuItem new];
NSMenu *fileMenu = [[NSMenu alloc] initWithTitle:@""];
[fileMenuItem setTitle:@"File"];

But this does not work:
NSMenuItem *fileMenuItem = [NSMenuItem new];
NSMenu *fileMenu = [[NSMenu alloc] initWithTitle:@"File"];

@2xsaiko
Copy link

2xsaiko commented Dec 21, 2023

You are doing [fileMenuItem setSubmenu:fileMenu];, right? But even with that, you're right it doesn't work. Though I'm also very new to GNUstep/Cocoa, so I have no idea what is actually supposed to happen.

According to Apple documentation:

This property contains a string value indicating the title of the menu. If the menu is a submenu of the application’s main menu, then the title of the menu appears in the menu bar.

So yeah, it seems to me that the NSMenuItem should inherit the title of the NSMenu. But in setSubmenu: the opposite is happening: https://github.com/gnustep/libs-gui/blob/master/Source/NSMenuItem.m#L241

In any case, this doesn't seem to be related to initWithTitle, but rather that in the top code you're setting the title of the NSMenuItem, in the bottom code you're setting the title of the NSMenu.

@gcasa gcasa added the bug A bug, but not a show stopper label Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug, but not a show stopper
Development

No branches or pull requests

3 participants