Re: How to add a window to a window list(or open document list) on a dock tile menu?
Re: How to add a window to a window list(or open document list) on a dock tile menu?
- Subject: Re: How to add a window to a window list(or open document list) on a dock tile menu?
- From: JongAm Park <email@hidden>
- Date: Tue, 27 Jan 2015 15:17:11 -0800
I solved my problem and would like to share how I did it.
I’m working on a heavily customized app on top of Cocoa/Carbon.
So, general paradigm of Cocoa and Carbon is partially applied : how to enable menu items, how to make windows, and so on.
However, there is a link to Cooca at the bottom of our S/W architecture. It means that there was some missing stuff in terms of the Window list on a Dock menu.
I found out that the Window list ( may called open document list ) is the same to those under Window menu bar item on a genuine Cocoa app (why not)
It turned out that if NSApp.windowsMenu returns nil ( means there is no Windows menu associated with it ), when a new Window is created, it can’t be added to the “Windows list”. I played with a skeletal Cocoa app and tried to remove menu items from default Windows menu, deleted the Windows menu, replaced with other menu, etc.
With Interface builder module, the title “Windows” plays significant role. Based on the name, Interface Builder looks to treat it as “Windows” menu and associate with NSApplication as such. Anyway, even without any menu items under the menu, it populated with new window names whenever a new window is created and displayed.
So, in our own very customized code to generate our own menu bar and its sub items, I found out that we didn’t set “Window” menu as Windows menu of NSApp. Once I set it, it started to display on the Dock tile menu.
Because we added window names manually to the menu, I worried if same window names may appear twice : one by our manual insertion/addition and the other by automatic addition of Cocoa when displaying an instance of NSWindow. However, it didn’t. Luckily our “Window” menu also had the window list at the end, not anymore in its middle. So, there was no further work required.
Anyway, thank you for your hint. Although I asked about dock menu and I was so soaked with dock menu, but your mentioning of applicationDockMenu: gave me some idea, and started to think differently. :)
(BTW, It can be better if Apple name the portion of Dock menu as Windows name list and mention that it’s linked to Windows menu’s window name list. Without it, yes.. we can guess. However, I first thought it as “Opened Document List” and looked up NSDocumentController. There I found addDocument:. It mentioned about “open document list”. So, I lost my direction there at first. But a small icon in front of Window list items gave me a clue. The icon was for “window” not “document”. So, I guessed that it may be called “current window list” instead of “open document list”. With your hint and such guess made me to look at “Windows” menu. :)
Well.. it’s how I solved. If someone work on their own framework written on top of Cocoa and run into similar problem like mine, I hope he would be able to find a clue from this post. :)
Happy coding~
JongAm Park
> On Jan 27, 2015, at 12:55 PM, Lee Ann Rucker <email@hidden> wrote:
>
> -[NSApplicationDelegate applicationDockMenu:]
>
> You can customize everything except the recent documents; you get that for free and can't get rid of it - no, not even if the user clears recent documents from the main menu.
>
> On Jan 27, 2015, at 10:38 AM, JongAm Park <email@hidden> wrote:
>
>> Hello, all. It has been long time for me to write anything in this mailing list, but I prefer this than web based one Apple now pushes.
>>
>> Anyway.. I have some issue with “Window list”
>>
>> If a window is created, it’s added to a window list under the “Window” menu and its equivalent counter part on the Dock menu.
>> However, in a project I work on nowadays, ( which is heavily customized on top of Cocoa and old Carbon ), it has a window list menu items under “Window” menu, but somehow there is no such thing on the Dock menu.
>>
>> It’s not document based app. (Well.. I mean it’s not based on NSDocument. We have our own mechanism for managing our in-house document type. )
>> I tried setExcludedFroWindowsMenu: of NSWindow to see if it has any effect on the Dock menu, but it didn’t.
>>
>> Is there anyway to have Dock menu contain the window list menu items?
>>
>> I searched Apple’s documents, but there looks to be no explicit way to remove/add window list.
>>
>> Thank you.
>> JongAm Park
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.apple.com_mailman_options_cocoa-2Ddev_lrucker-2540vmware.com&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=ie7S-J__EKnfyVOBV7-jV2rZ--p47O6vkyTklpDM3h4&m=hjEqDZ8jEpHgyNJtfaA4FaxGdsZAsosDKscQglYgNj8&s=8RSNVk4UJgxTxrQv7wfY3bFC1h_KbfGPw4gqQBO3jfc&e=
>>
>> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden