Tuesday, August 21, 2007

Picking up PageSetup Dialog Changes

The standard Page Setup dialog (OK, "sheet") can be customized by implementing -runPageLayout in your NSApplication or NSDocument subclass. It's all nicely documented in Apple's fine Developer Docs.

But what if the standard dialog is fine for your needs but you still want to run some code when the user changes the page setup?

All you need to do is implement -setPrintInfo in your NSDocument subclass. It'll get called with the new printInfo. Something like this:

- (void) setPrintInfo:(NSPrintInfo*)info
{
[super setPrintInfo:info];
[self myCodeThatDoesSomethingWithTheNewPrintInfo];
}

No comments: