How to correctly display a “progress” sheet modally while using Grand Central Dispatch to process something?

As stated by Brad, it should work. To do a quick test, I created a sheet programmatically (normally, you would probably use a nib file, but they are hard to paste into this text). If I call the code below from a button in a normal Cocoa window, it works as expected.

Notice that the text field on the sheet is first responder, and if you type on the keyboard while it is open, it will accept the input. #define maxloop 1000 - (IBAction)startTask:(id)sender { // Prepare sheet and show it... breakLoop = NO; NSRect sheetRect = NSMakeRect(0, 0, 400, 114); NSWindow *progSheet = NSWindow alloc initWithContentRect:sheetRect styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:YES; NSView *contentView = NSView alloc initWithFrame:sheetRect; NSProgressIndicator *progInd = NSProgressIndicator alloc initWithFrame:NSMakeRect(143, 74, 239, 20); NSTextField *inputField = NSTextField alloc initWithFrame:NSMakeRect(145, 48, 235, 22); NSButton *cancelButton = NSButton alloc initWithFrame:NSMakeRect(304, 12, 82, 32); cancelButton. BezelStyle = NSRoundedBezelStyle; cancelButton.

Title = @"Cancel"; cancelButton. Action = @selector(cancelTask:); cancelButton. Target = self; contentView addSubview:progInd; contentView addSubview:inputField; contentView addSubview:cancelButton; progSheet setContentView:contentView; NSApp beginSheet:progSheet modalForWindow:self.

Window modalDelegate:nil didEndSelector:NULL contextInfo:NULL; progSheet makeKeyAndOrderFront:self; progInd setIndeterminate:NO; progInd setDoubleValue:0. F; progInd startAnimation:self; // Start computation using GCD... dispatch_async(dispatch_get_global_queue(0, 0), ^{ for (int I = 0; I.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions