• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Re: Synchronous modal sheet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Synchronous modal sheet


  • Subject: Re: Re: Synchronous modal sheet
  • From: Daniel Dickison <email@hidden>
  • Date: Fri, 15 Aug 2008 13:22:05 -0400

Yeah, I've worked with sheets before in different contexts. The problem with this one is that I want to display the sheet during the first iteration of a loop (in which I do a bit of work with other loops), and splitting it up will take some work. But unless there are any good alternatives to a sheet, I suppose I'll go for it.

I've thought about writing code like that so that it happens in a separate thread, and having a synchronous method that shows the sheet in the main thread and waits on a simple lock that gets unlocked by the sheetDidEnd method (via the main thread).


It seems like it should work, but I've never actually tried it.

Maybe something like this (written in Mail):

// This gets called from a worker thread.
- (NSInteger) showSynchronousSheet {
[self performSelectorOnMainThread:@selector(showSheet) ... waitUntilDone:YES];
[mySheetLock lock];
[mySheetLock unlock];
return mySheetReturnCode;
}


// These happen on the main thread.
- (void) showSheet {
	[mySheetLock lock];
	// Actually show the sheet
}

- (void) sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo {
[sheet orderOut:self];
mySheetReturnCode = returnCode;
[mySheetLock unlock];
}


_______________________________________________

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


  • Prev by Date: Re: Question about directory for Application Caches
  • Next by Date: Re: Making a bound view re-read its value
  • Previous by thread: Re: Synchronous modal sheet
  • Next by thread: Question about directory for Application Caches
  • Index(es):
    • Date
    • Thread