discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GUI issue - adding item to Menu


From: Wolfgang Lux
Subject: Re: GUI issue - adding item to Menu
Date: Fri, 13 May 2016 11:40:50 +0200

> Am 13.05.2016 um 11:22 schrieb Riccardo Mottola <address@hidden>:
> 
> Hi,
> 
> I discovered a very strange behaviour. I think it is a bug and it would be 
> nice in case to solve it before release.
> 
> I think that if the Main app menu is called "X" and you add a submenu also 
> called "X" and then add items Y to submenu X, they get added to the main menu 
> and the submeni disappears.
> 
> Where to check: latest Terminal code from GAP.
> Code in main.m:
> http://svn.savannah.nongnu.org/viewvc/trunk/system-apps/Terminal/main.m?revision=3185&root=gap&view=markup
> 
> Terminal has a Main Menu called "Terminal". It used to have a sub-menu called 
> Terminal (there are screenshots that prove that it worked). The code was 
> commented out.
> I put it back in, it doesn't work well.
> However if I name the submenu "foo" it works. I suppose a quirk!
> 
> The code section is:
> 
>       /* 'Terminal' menu */
>       m=[[NSMenu alloc] init];
>       [m addItemWithTitle: _(@"New window")
>               action: @selector(openWindow:)
>              keyEquivalent: @"n"];
>       [m addItemWithTitle: _(@"New tab")
>               action: @selector(openTab:)
>               keyEquivalent: @"t"];
>        [menu setSubmenu: m forItem: [menu addItemWithTitle: _(@"Terminal")]];
>       [m release];
> 
> 
> Ideas?

Yes. Don't use the same name for the main menu and another application menu, 
it's a bad idea anyway (on OS X you would end up with two items with the same 
name in the menubar). Incidentally, Apple calls their equivalent of your 
'Terminal' menu 'Shell' in their Terminal application (and have historically 
done so already in the NeXTstep days).

Wolfgang




reply via email to

[Prev in Thread] Current Thread [Next in Thread]