Why do my WebView controls do a mini-reload when they become key?

2014-08-19 Thread Daryle Walker
This has happened since my first version of the app. When the WebView has the 
control focus, clicking in it is fine. When the NSTextField has focus and I 
click the WebView, which switches focus, the WebView does a mini-reload and 
visual refresh. It doesn’t reset the Back/Forward history, thank goodness. But 
Safari doesn’t do this when switching between its text and web controls. Why? 
(I want to fix this annoyance.)

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Issuing NSTextField action message

2014-08-19 Thread Ken Thomases
On Aug 19, 2014, at 8:33 PM, Carl Hoefs  wrote:

> OS X 10.9.4  I have an NSTextField into which a user types digits. When a 
> digit is typed, I have it set up so the -controlTextDidChange: delegate 
> method is invoked. Now, in the delegate method I would like (depending on 
> circumstances) to cause the text field to behave like the user ended editing 
> to send its action message.

What exactly do you mean?  What behaviors?  Do you just mean you want the 
action message to be sent?  Or do you want the text field to change state or 
something?  Do you want it to still have focus and be editing?

Regards,
Ken


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

AutoLayout textfield against accessory view

2014-08-19 Thread Luther Baker
I'd like to place a UITextField in the center of a UITableViewCell such
that initially, the textfield extends to all four sides.

But ... I'd also like to make it AccessoryView friendly. Namely, when the
accessory appears (or is always appearing) I want the aforementioned
textField to shrink and not overlap the accessory. I want my textField's
TRAILING attached to the accessoryView's LEADING.

Thoughts? My initial pass complains about objects in different hierarchies.

Thanks,
-Luther
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Issuing NSTextField action message

2014-08-19 Thread Graham Cox

On 20 Aug 2014, at 11:33 am, Carl Hoefs  wrote:

> OS X 10.9.4  I have an NSTextField into which a user types digits. When a 
> digit is typed, I have it set up so the -controlTextDidChange: delegate 
> method is invoked. Now, in the delegate method I would like (depending on 
> circumstances) to cause the text field to behave like the user ended editing 
> to send its action message. Is this possible? The text field action is set to 
> “Sent on End Editing” in Xcode. I’ve noticed that at runtime that [tField 
> action] is null.


Yes, it's possible. But note that during editing, you're actually use the Field 
Editor, not the control itself. So you need to get the action from the actual 
control, not the field editor. You might need to do work to track which field 
is being editied, if you can't infer it from properties of the field editor.

--Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Issuing NSTextField action message

2014-08-19 Thread Carl Hoefs
OS X 10.9.4  I have an NSTextField into which a user types digits. When a digit 
is typed, I have it set up so the -controlTextDidChange: delegate method is 
invoked. Now, in the delegate method I would like (depending on circumstances) 
to cause the text field to behave like the user ended editing to send its 
action message. Is this possible? The text field action is set to “Sent on End 
Editing” in Xcode. I’ve noticed that at runtime that [tField action] is null.
-Carl



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Storing a value to access across app launches and even re-install

2014-08-19 Thread Graham Cox

On 19 Aug 2014, at 3:25 pm, Navneet Kumar  wrote:

> I need to store a numeric value in the system and update and access it across 
> every launch of my app.

NSUserDefaults


> Also is it possible to safely store it in the system so that it can be picked 
> up even after a re-install of my app?

NSUserDefaults

> I want it to be secure, so that even a os x savvy user may not be able to 
> delete/modify this value.


Not really possible - the user owns their own computer, they can do with them 
as they wish. However, there are ways to hide a setting so that it's harder to 
find. An easy-ish solution is to use CFPreferences in the 'by host' domain. 
It's not very hidden, but slightly more so than the normal user defaults. You 
can also write a value to a file in all sorts of locations (notwithstanding 
what sandbox might have to say about it) but a determined user can always find 
it and delete it. This is right and proper - as a user I have every right to 
know exactly what my computer is doing, and no part of it should be hidden or 
inaccessible from me.

--Graham





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

How do I use loadAlternateHTMLString:baseURL:forUnreachableURL: with webView:didFailProvisionalLoadWithError:forFrame:?

2014-08-19 Thread Daryle Walker
I’m not sure what parameters you’re supposed to use with the former method, 
especially within the latter. I got:

> - (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError 
> *)error forFrame:(WebFrame *)frame
> {
> if (frame == sender.mainFrame) {  // Ignore notices from sub-frames.
> //[self performSelector:@selector(showError:) withObject:error 
> afterDelay:0.1];
> NSString * const  htmlString = [NSString stringWithFormat:@" version=\"1.0\" encoding=\"UTF-8\"?>"
> " XHTML 1.1//EN\""
> 
> "\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\";>"
> " xmlns=\"http://www.w3.org/1999/xhtml\";>"
> "Provisional Load 
> Error"
> ""
> "URL%@"
> "Error%@"
> "", 
> frame.dataSource.initialRequest.URL, error];
> [frame loadAlternateHTMLString:htmlString baseURL:[NSBundle 
> mainBundle].resourceURL 
> forUnreachableURL:frame.dataSource.initialRequest.URL];
> }
> }


changing from posting a (now commented-out) error alert. I’m trying two cases.

A. Open a new window to the home page (http://www.apple.com), and change the 
URL to a nonexistent site.
B. Use the “Open Recent” menu to open a file I know I can’t handle. (The menu 
dates from before I added filters and ripped out the NSDocument architecture to 
add new files to it. It’s very useful as-is, though.)

I get:
1. The bundle resource directory is in the URL entry field and the 
command-click window title menu.
2. When I get an error page, it looks like:

> URL
> file:///MY-APP'S-RESOURCE-DIRECTORY
> Error
> Error Domain=WebKitErrorDomain Code=102 "Frame load interrupted" 
> UserInfo=0x608000661d40 
> {NSErrorFailingURLStringKey=file:///MY-APP'S-RESOURCE-DIRECTORY, 
> NSLocalizedDescription=Frame load interrupted, 
> NSErrorFailingURLKey=file:///MY-APP'S-RESOURCE-DIRECTORY}


with the resource directory in the URL entry field and for the window title 
bar’s icon and command-click file menu.

Run 1: home page, no Back nor Forward active -> enter bad hostname -> error 
page like above, Back menu has TWO entries, a “Provisional Load Error” and the 
home page -> go Back once -> home page, Back menu has home page, Forward menu 
has Provisional Load Error -> go Back once -> home page, Forward menu has home 
page and Provisional Load error -> go Forward twice -> error page, except the 
line under the “URL” title is the home page’s URL -> go Back once -> error 
page, first edition….

I think I’m supposed to be resetting something between uses or some other 
misconfiguration is happening. Help.

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSSpellChecker exception

2014-08-19 Thread Martin Wierschin
> Thanks, so they can be safely ignored. Does that also apply to similar 
> exceptions (much rarely reported) related to DO and coming from:
> 
> -[IMKInputSession activate] (in HIToolbox)   resulting in
> NSPortTimeoutException: connection timeout: did not receive reply
> ...


I can't speak with any authority, but my apps having been ignoring those port 
exceptions during beta testing for years to good effect. You may also want to 
add NSAccessibilityException to your ignore list, since it is also seems to be 
caught by Apple frameworks as necessary.

~Martin Wierschin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: How to convert String.Index to UInt?

2014-08-19 Thread Quincey Morris
On Aug 19, 2014, at 02:06 , Gerriet M. Denkmann  wrote:

> But what about:
>   SELPlus aSelector = BetterSelectorFromString ( aSelectorName, "returns 
> object which does NOT need to be released" );
>   id a = [ self performSelector: aSelector ]; 
> 
> Or (if modifying SEL is not viable):
>   id a = [ self performSelector: aSelector withInfo: "returns object 
> which does NOT need to be released" ]
> 
> This should work (as long as I do not lie about my selector), shouldn't it?

In general, the compiler is going to want the equivalent of a method signature  
— that is, full information about all of the parameters as well as the return 
value. (Obj-C has already gone down this road. There’s a NSMessageSignature 
class, not to mention NSInvocation, which has its own memory management rules. 
These are horrible to use.)

In Obj-C, the whole performSelector thing is unpleasant in general (think of 
those didEnd… selector parameters), but easy enough in the simplest cases — at 
the cost of lacking full ARC-correctness.

Obj-C has a solution: blocks. These are superior to performSelector in all 
functional respects**, but they’re uglier and fussier to write.

Swift has the same solution — closures — and goes to some trouble to make them 
less ugly and less fussy than the Obj-C version.

I’d say it’s worth putting some effort into retraining yourself to stop using 
selector-based implementations *in Obj-C*. It’ll improve your Obj-C code, as 
well as easing any transition to Swift.


** Except perhaps the ease with which they cause retain cycles.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Storing a value to access across app launches and even re-install

2014-08-19 Thread 2551
It's impossible to store something on a users computer and make it invulnerable 
from the user deleting it.

The best you can do is hide it, but there are various ethical hoops to jump 
through with that one.

Notwithstanding better advice from other list members, about best advice i've 
seen on this topic is summarized here:

http://stackoverflow.com/questions/7730916/how-do-you-make-a-cocoa-demo-app-that-only-works-for-a-limited-time


Best

Phil
On 19 Aug 2014, at 12:25, Navneet Kumar  wrote:

> Hi,
> 
> I need to store a numeric value in the system and update and access it across 
> every launch of my app.
> Also is it possible to safely store it in the system so that it can be picked 
> up even after a re-install of my app?
> I want it to be secure, so that even a os x savvy user may not be able to 
> delete/modify this value.
> 
> Its more like the apps that allow a certain number of launches with full 
> functionality before requiring registration.
> 
> Thanks in advance.
> 
> Best,
> Navneet
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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://lists.apple.com/mailman/options/cocoa-dev/2551phil%40gmail.com
> 
> This email sent to 2551p...@gmail.com



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSPageLayout obsolete?

2014-08-19 Thread Ken Thomases
On Aug 19, 2014, at 3:17 AM, Quincey Morris 
 wrote:

> Keep in mind that two conditions must be satisfied for a menu item to be 
> enabled:
> 
> a. There must be an object in the responder chain that implements the 
> associated action method.
> 
> b. *That object* must return YES from validateUserInterfaceItem.

Or -validateMenuItem: or implement neither.  If there's no validation method, 
the menu is enabled.

Regards,
Ken


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Transparent NSImage in NSButton

2014-08-19 Thread Aandi Inston
I'm wondering what the "right" way is to use transparent images in an
NSButton (not using Interface Builder as this is a port of a platform
independent dialog library, which is also required to work back to 10.5).
Transparent images here = PDF loaded as NSImage which do not paint their
entire canvas.

These NSButton elements sit in an NSWindow with default background Color.
The problems:
- sometimes (as yet unclear when but it might have started when we started
to set image scaling) the first paint of the image has a
white background.
- subsequent repaints (e.g. when the button is clicked) repaint on the
window's background, i.e. seemingly as required
- each subsequent repaint does not clear the background. This results in
repeated clicks making the image darker and darker, or if there is an
alternate image we are left with the shadow of both.

Key definitions
- NSButton setImagePosition:NSImageOnly setBordered:no and
[[button cell] setImageScaling:NSImageScaleProportionallyUpOrDown]
- For a single image, NSButton setImageType:NSMomentaryLightButton
- For two image, NSButton setImageType:NSToggleButton or
NSMomentaryChangeButton

I'm wondering if I need to add code that causes the button area to be
erased or repainted in the background colour before it is painted. Or
perhaps use a different control/view type altogether (NSImageView?) and
mandate non-transparent images where button functionality is actually
needed.

Thanks in advance.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: How to convert String.Index to UInt?

2014-08-19 Thread Gerriet M. Denkmann

On 18 Aug 2014, at 12:44, Quincey Morris  
wrote:

> On Aug 17, 2014, at 21:36 , Gerriet M. Denkmann  wrote:
> 
> Watching (so to speak) what you’re doing from a distance, what concerns me is 
> *not* that you are or are not doing things in a swifty way, but that you’re 
> *evaluating* Swift when it’s still in an incomplete form — unstable, 
> under-documented, and under-implemented. I know you’ve said you’re “just” 
> trying to learn the new language at this point, but I think there’s a danger 
> that you’ll conclude that the new language is unusable (or incomprehensible, 
> or something) *because of* its current incomplete form.

Well, if there are any issues with Swift (while still being in beta) they 
should be raised right now.
Changing them will be much more difficult later on.

Here some interesting links I just found:






[ regarding performSelector: ]

> 
> This particular issue isn’t Swift-related, but ARC-related.
> 
> The value of ARC is that it preserves correctness (memory-management 
> correctness, I mean) in source code that follows the ARC rules. Within the 
> ARC domain — that is, if you write code according to the rules — you *cannot* 
> have any memory management errors**. But you only get this happy outcome if 
> you stay within the ARC domain. If you invoke code that doesn’t use ARC, or 
> that ARC tells you is unsafe, then there is no guarantee of correctness. (Of 
> course, your app may turn out to be correct if this non-ARC-domain code has 
> no memory management bugs, but the correctness then comes from something 
> outside of ARC’s purview.)
> 
> The problem with ‘performSelector:’ is that it can break out of the ARC 
> domain. Even if the invoking code uses ARC, and the performed code uses ARC, 
> the transition between them isn’t necessarily correctness-preserving.
> 

I use this:
NSString *aSelectorName = ...
SEL aSelector = NSSelectorFromString ( aSelectorName );
id a = [ self performSelector: aSelector ]; <--  PerformSelector may 
cause a leak because its selector is unknown

But what about:
SELPlus aSelector = BetterSelectorFromString ( aSelectorName, "returns 
object which does NOT need to be released" );
id a = [ self performSelector: aSelector ]; 

Or (if modifying SEL is not viable):
id a = [ self performSelector: aSelector withInfo: "returns object 
which does NOT need to be released" ]

This should work (as long as I do not lie about my selector), shouldn't it?


Kind regards,

Gerriet.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSPageLayout obsolete?

2014-08-19 Thread Quincey Morris
On Aug 19, 2014, at 00:32 , Daryle Walker  wrote:

> I looked for -runPageLayout: in NSApplication.h, and I couldn’t find it. 
> That’s why I thought this action may be obsolete and unsupported.
> 
> However…
> 
> There are a lot of methods in the HTML docs for NSApplication. I thought the 
> provided -runPageLayout: was a myth, but it’s actually there! I didn’t see it 
> until the fifth re-read. So this base-class version is official. But why 
> didn’t I see it in the header? (And that time I did use Command-F to help.) 
> In the HTML docs, I usually skip over a method’s listed header, since it’s 
> usually obvious. But looking at it this times shows that the method is in a 
> different header! Sure enough, the method is in that header.

The best way to find methods in the Cocoa headers is to use Command-Shift-O. 
Guessing which header file you want is an exercise in frustration.

> So, to have an app-global Page Setup command:
> 
> 1. Either insert an app-global responder, ahead of the application object, to 
> handle the action. I guess the NSDocument system does this.

I don’t think so. TextEdit is a NSDocument-based application, but Page Setup… 
isn’t enabled unless a document is open. In that case, the document object is 
in the responder chain, and so handles the menu item, but there’s nothing 
“app-global” about it.

> 2. Or replace NSApplication with a subclass that implements:
> 2a. -validateUserInterfaceItem:, which must test for the -runPageLayout: 
> action and allow it. (Pass other actions to super.)

I dunno about this. It’s possible that once upon a time Page Setup… was 
generally enabled by NSApplication (I don’t remember), but the TextEdit case 
suggests that it isn’t so now. (I also looked at an old app of my open that 
happens to have Page Setup on the File menu, and it doesn’t get enabled there 
either.) The fact that NSApplication has the action method doesn’t imply that 
NSApplication does anything to enable the menu item.

> 3. Note that you cannot use the application delegate to store the method. The 
> hacks used to consider the delegate a responder don’t include that method 
> and/or the application object goes first and locks out the delegate from 
> providing an override.

This sounds wrong. Keep in mind that two conditions must be satisfied for a 
menu item to be enabled:

a. There must be an object in the responder chain that implements the 
associated action method.

b. *That object* must return YES from validateUserInterfaceItem.

You can’t implement the validation in one place and have the implementation 
somewhere else. If you want to avoid subclassing NSApplication, you could 
implement Page Setup in the app delegate, but you’d have to do both (a) and (b) 
— even if (a) just invoked the NSApplication implementation.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSPageLayout obsolete?

2014-08-19 Thread Daryle Walker
On Aug 18, 2014, at 10:35 PM, Kyle Sluder  wrote:

> On Aug 18, 2014, at 7:27 PM, Daryle Walker  wrote:
> 
>> On Aug 18, 2014, at 1:03 PM, Daryle Walker  wrote:
>> 
>>> 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?
>> 
>> I tried the menu-level validation method in the app delegate. Didn’t work. 
>> Is NSApplication somehow blocking this action from going through? (The app 
>> delegate gets the actions for new-document and open-document.)
>> 
>> Was going to try the general-level validation method, but I glanced at the 
>> web page I had open to the Printing Guide (i.e. I RTFM) and saw:
>> 
>>> When running an app that is not document based, you must override the 
>>> runPageLayout: method of the NSApplication class. You can also implement 
>>> the method earlier in the responder chain. If you want to add an accessory 
>>> view, your runPageLayout: method needs to call the addAccessoryController: 
>>> method.
> 
> My next question was going to determine whether this was the case. ;-)

I’ve dreamt of going into Cocoa programming for years (decades?), but didn’t 
start until a month ago. I’ve read that Cocoa & Objective-C have a lot of 
power. I think the problem is there’s so much power it’s hard to initially 
learn and/or keep track. (I wish there was something that would handle X…. 
There is, but it’s so obscure most people don’t recall it.)

>> (BTW, since the app delegate usually doesn’t subclass NSResponder, how/why 
>> is it part of the responder chain?)
> 
> Legacy and convenience. It’s like that on iOS too.
> 
>> I gave in and made an NSApplication subclass. I added a public override of 
>> -runPageLayout: and changed the initial class in the MyApp-Info.plist file. 
>> Didn’t work. Changed the class of the Application object of my two XIB files 
>> to my new class. Didn’t work. Thinking of overriding -sharedInfo in case the 
>> default implementation didn’t pay attention to what I listed as the initial 
>> class. Then I tried one last thing: making a general-level validation method 
>> (since NSApplication implements that protocol). Got it to work!
> 
> Yeah, you have to remember to do both.
> 
> Kinda sucks that you have to jump through this hoop, but the subclassing 
> requirement is an artifact of a different era, and obviously works well 
> enough (for the few non-document based apps that use it) that it’s not worth 
> changing.
> 
>> Then I poked around. I replaced -runModalWithPrintInfo with -runModal after 
>> first mistakenly doing NSPrintPanel methods. Then I changed the call to 
>> [super runPageLayout:sender] and it worked. NSApplication can do it, but it 
>> doesn’t want to. So I took out my override. Everything still works as long 
>> as I keep the general-level validation method around.
>> 
>> New Questions:
>> 1. Is it safe to depend on the NSApplication version of -runPageLayout: 
>> (i.e., only override -validateUserInterfaceItem:)?
> 
> I’d say no. Since you have to subclass to implement the validator, providing 
> the correct implementation of the actual action is trivial.

I looked for -runPageLayout: in NSApplication.h, and I couldn’t find it. That’s 
why I thought this action may be obsolete and unsupported.

However…

There are a lot of methods in the HTML docs for NSApplication. I thought the 
provided -runPageLayout: was a myth, but it’s actually there! I didn’t see it 
until the fifth re-read. So this base-class version is official. But why didn’t 
I see it in the header? (And that time I did use Command-F to help.) In the 
HTML docs, I usually skip over a method’s listed header, since it’s usually 
obvious. But looking at it this times shows that the method is in a different 
header! Sure enough, the method is in that header.

Some of the WebView delegates are informal protocols implemented as methods of 
a category on NSObject. Apple extended this to other classes; -runPageLayout: 
for NSApplication is imported from a category in NSPageLayout.h. Once again, 
Apple has a well-thought-out system everyone else thinks is too complicated. I 
was thinking I going to program this over the summer while biding my time for 
Yosemite & Swift; now I think I’m going to stick with Objective-C, at least 
until Swift bakes enough for prime-time.

>> Otherwise, I would need to override only if I ever added an accessory view.
>> 2. Does said message manipulate the shared NSPrintInfo object?
> 
> Probably, but there’s