• 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
Modal NSOpenPanel not withdrawn until didEndSelector argument finished working?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Modal NSOpenPanel not withdrawn until didEndSelector argument finished working?


  • Subject: Modal NSOpenPanel not withdrawn until didEndSelector argument finished working?
  • From: Ivan Kourtev <email@hidden>
  • Date: Mon, 27 Mar 2006 18:22:26 -0500

Hi all,

I use a modal NSOpenPanel attached to a window to allow the user to select a file. Once the selection is complete, I read the file and do a few things. But I am a little confused as to when the panel is dismissed.

So I basically send a beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSel ector:contextInfo: to the panel. In the delegate, I've setup the didEndSelector: argument which appropriately gets called once the file selection is made in the panel. Inside this method there is some simple code such as what's shown at the end. The 'problem' is that the sheet is still there attached at the window even after the user has selected the file and clicked "Open". The sheet doesn't go away until the didEndSelector is finished working on fileName.

Is this acceptable and reasonable behavior? I thought the sheet runs in its own thread and will be withdrawn as soon as the selection has been made? Maybe not? I thought someone can shed some light on this (while I am working on another version that spawns a separate thread to do the work with the selected file).

Thanks,

-- ivan

- (void)singleOpenFileSheetDidEnd:(NSOpenPanel *)sheet
                       returnCode:(int )returnCode
                      contextInfo:(void *)contextInfo
{
    if ( returnCode == NSCancelButton ) {
        [NSApp terminate:self];
    }
    assert( returnCode == NSOKButton );
    NSString *fileName = [[sheet filename] retain];
    /* do stuff with fileName */
}

_______________________________________________
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


  • Prev by Date: Re: CustomView that forwards mouse events to lower views?
  • Next by Date: Draw a single bitmap multiple times into an NSView?
  • Previous by thread: Core Data <--> NSTreeController ==> [MO count]: selector not recognized
  • Next by thread: Draw a single bitmap multiple times into an NSView?
  • Index(es):
    • Date
    • Thread