• 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
drawing problem after multiple overlapping sheets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

drawing problem after multiple overlapping sheets


  • Subject: drawing problem after multiple overlapping sheets
  • From: Alex Reynolds <email@hidden>
  • Date: Mon, 10 Dec 2001 02:24:38 -0500

Overview: two sheets seems to be interfering with each other...

I have a NSWindow object called tickerControl, into which I draw the first sheet, an NSOpenPanel (in sheet form).

I have a conditional in this NSOpenPanel's -openPanelDidEnd as follows:

- (void) openPanelDidEnd: (NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton) {
NSLog(@"Resource was selected for addition");
// call the second "attributes sheet" method here since we selected a resource
[self openAttributesSheet];
}
else {
NSLog(@"Resource was not added");
}
}

I have a method called -openAttributeSheet that builds an additional sheet via [NSApp -beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo] and calls it via [NSApp runModalForWindow].

This method is called after the "// call additional 'attributes sheet' here..." comment and draws an NSPanel containing a few NSTextFields and two NSButtons (OK and Cancel).

Sheets are drawn properly under the correct window when I run the program.

Okay, so this is what my email is about:

-- I get the OpenPanel to pull down from the tickerControl NSWindow, no problem so far
-- I click "OK" to select a resource
-- The OpenPanel sheet does not close, uh oh
-- The "OKButton" conditional passes and the call to the AdditionalAttributes sheet is made, opening that sheet on top of the OpenPanel sheet
-- I click "OK" to the AdditionalAttributes sheet, which closes it
-- The OpenPanel sheet closes

I then get white space over where the OpenPanel sheet once was, before it closed. I cannot reach any controls underneath the white space. The NSWindow tickerControl doesn't redraw.

Is there any way to force the OpenPanel sheet to close before the second sheet opens? That is, is that what is causing the redraw problems I am seeing?

I tried adding the following to -openPanelDidEnd inside the conditional:

while ([tickerControl attachedSheet] != nil] {
// there's still a sheet attached to the NSWindow, so just wait
}
// okay, the sheet is closed, now open the second sheet
[self openAttributesSheet];

but this resulted in an infinite loop which required a Force Quit to close.

Thanks for any suggestions...

Regards,
Alex


  • Follow-Ups:
    • Re: drawing problem after multiple overlapping sheets
      • From: John Hörnkvist <email@hidden>
  • Prev by Date: Re: HTML Notification
  • Next by Date: Re: QT movies...
  • Previous by thread: Re: How to get scripting to work without NSApplication
  • Next by thread: Re: drawing problem after multiple overlapping sheets
  • Index(es):
    • Date
    • Thread