• 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: Widgets turning white and never unturning white?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Widgets turning white and never unturning white?


  • Subject: Re: Widgets turning white and never unturning white?
  • From: glenn andreas <email@hidden>
  • Date: Thu, 14 Jul 2005 08:03:50 -0500


On Jul 14, 2005, at 3:23 AM, Theodore H. Smith wrote:


I got around to looking at this:

[sheet beginSheetForDirectory:nil
file:name
modalForWindow:window
modalDelegate:self
didEndSelector:@selector (savePanelDidEnd:returnCode:contextInfo:)
contextInfo:cfd
];
assert( true ); // just set a breakpoint here.


The open dialog fires, and then the breakpoint is trapped immediately, even before I closed the dialog!


Which is what it is suppose to do - sheets aren't blocking (since when a sheet is open in one window, you can still do anything you want in a second window).


However, if I do this code:

[sheet beginSheetForDirectory:nil
file:name
modalForWindow:window
modalDelegate:self
didEndSelector:@selector (savePanelDidEnd:returnCode:contextInfo:)
contextInfo:cfd
];
[NSApp runModalForWindow:sheet];
assert( true ); // just set a breakpoint here.


The breakpoint only files when the dialog closes.


This is bad.


I'm a bit unsure about how to get modal sheets.


That's the problem - sheets aren't modal and blocking across the whole system. They are non-modal, and there is various architecture in Cocoa to make them act as document modal only (so the rest of your code continues to run for everything else).

Basically, while a sheet is up, only actions pertaining to that sheet get done - doing things like clicking in the underlying window do nothing except beep.

When the sheet is done, the didEndSelector is called and you continue on with whatever you need to do, now that the user has done whatever they've needed to in the sheet.

So basically, instead of being

- doSomething
{
    set up the dialog
    runModalForWindow (blocks _everything_ until complete)
    process results from dialog
}

you get

- doSomething
{
set up the dialog
beginSheetForWindow: didSomething
return so system continues to treat all other windows as normal except this one window
}


- didSomething
{
    process results from dialog
}





Glenn Andreas                      email@hidden
 <http://www.gandreas.com/> wicked fun!
Widgetarium | the quickest path to widgets

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Widgets turning white and never unturning white? (From: "Theodore H. Smith" <email@hidden>)
 >Re: Widgets turning white and never unturning white? (From: glenn andreas <email@hidden>)
 >Re: Widgets turning white and never unturning white? (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: C string conversions?
  • Next by Date: Re: font of "i" in dashboard widgets?
  • Previous by thread: Re: Widgets turning white and never unturning white?
  • Next by thread: Re: Widgets turning white and never unturning white?
  • Index(es):
    • Date
    • Thread