Open optimisme opened 11 months ago
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.
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"];