Re: NSPageLayout obsolete?
Re: NSPageLayout obsolete?
- Subject: Re: NSPageLayout obsolete?
- From: Daryle Walker <email@hidden>
- Date: Mon, 18 Aug 2014 13:03:57 -0400
On Aug 18, 2014, at 12:30 PM, Kyle Sluder <email@hidden> wrote:
>> On Aug 18, 2014, at 9:13 AM, Daryle Walker <email@hidden> wrote:
>>
>>> On Aug 18, 2014, at 8:36 AM, SevenBits <email@hidden> wrote:
>>>
>>> On Monday, August 18, 2014, Daryle Walker <email@hidden
>>> <javascript:_e({},'cvml','email@hidden');>> wrote:
>>>
>>>> I just read a post on StackOverflow that the “Page Setup…” menu item is
>>>> obsolete, especially for non-document apps. I tried a runPageLayout:
>>>> method that just did (void)[[NSPageLayout pageLayout] runModal] and nothing
>>>> happened; not even the menu item became active. Did I mess up, or did
>>>> Apple go hard core on new apps NOT using the panel?
>>>
>>>
>>> Does it work when you have it display as a sheet using the appropriate
>>> method?
>>
>> I didn’t try since I’m using the app-global PrintInfo object. And I already purged the menu item.
And said purging was 1 undo away to being brought back.
>> So what are we supposed to do now? The regular print panel didn’t seem to have replacement dialogs for that stuff. Do we just programmatically change the PrintInfo object as needed? (How would we know when it needs it?)
>
> Before you speculate like this, you should try the alternative. -beginSheet… is a drop-in replacement for -runModal. (Just use +[NSPrintInfo sharedPrintInfo].)
I added a runPageLayout: action to the window controller, and the menu command was enabled and it worked. I started with the -beginSheet… version, and later used the -runModal call, and both worked.
I then added the same action to the app delegate (using -runModelWithPrintInfo:). Worked fine when a window was open, but that still used the window controller version. But when I had no windows, the menu item was disabled, just like my first post! I thought that putting an action in the app delegate (without an explicit validation routine) always enables the corresponding menu item. That’s what happened when I added newDocment: and openDocument: actions after purging the NSDocument code. But that didn’t happen here. Did Apple add an override, or is it a bug? And how can I fix it?
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
_______________________________________________
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