shared PrintInfo
shared PrintInfo
- Subject: shared PrintInfo
- From: Eugen Schuler <email@hidden>
- Date: Sat, 2 Nov 2002 21:57:14 +0100
Hi @ll,
I've got a problem with a shared PrintInfo object in an application
that displays certain metafiles and that should be able to print all
open documents with the same printer settings. I tried to do that using
a shared PrintInfo, into which I'd like to store the most recent
changes to any document's printinfo. My approach doesn't work, because
the runPageLayout of NSDocument seems to be called asyncronously. In
other words, the app doesn't wait until the user changes any settings,
it just continues before the user dismisses the layout panel by
pressing the OK-button!
Has anybody any clue as to how I could catch the printInfo immediatly
after the user changes it?
Thanx in advance
Eugen
- (IBAction)runPageLayout:(id)sender
{
[super runPageLayout:sender]; // APP DOESNT STOP HERE!!!!!!!!
[NSPrintInfo setSharedPrintInfo:[self printInfo]];
}
- (IBAction)printAllDocuments:(id)sender
{
int i;
NSArray *docs = [NSApp orderedDocuments];
MetaFileDocument *theDoc;
for (i = 0; i < [docs count]; i++) {
theDoc = [docs objectAtIndex:i];
[theDoc setPrintInfo:[NSPrintInfo sharedPrintInfo]];
[theDoc printShowingPrintPanel: (i==0)];
}
}
- (void) printShowingPrintPanel:(BOOL)showPanels {
// Obtain a custom view that will be printed
NSView *printView = [self printableView];
// Construct the print operation and setup Print panel
NSPrintOperation *op = [NSPrintOperation
printOperationWithView:printView
printInfo:[self printInfo]];
[op setShowPanels:showPanels];
if (showPanels) {
// Add accessory view, if needed
}
// Run operation, which shows the Print panel if showPanels was YES
[self runModalPrintOperation:op
delegate:nil
didRunSelector:NULL
contextInfo:NULL];
[NSPrintInfo setSharedPrintInfo:[self printInfo]];
[printView release];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.