Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / October 2005



Tip: Looking for answers? Try searching our database.

Open Dialog Problems

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Darwin Darakananda - 18 Oct 2005 03:03 GMT
I'm quite new at cocoa and programming in general, am I got stuck with
trying to get open dialogs to work.  Here's the problem:

- (IBAction)editDictionary:(id)sender
{
    [dictionaryWindow makeKeyAndOrderFront:nil];

    NSOpenPanel *openPanel = [NSOpenPanel openPanel];
    SEL sel = @selector(openPanelDidEnd:returnCode:contextInfo:);
    [openPanel beginSheetForDirectory:@"~/Documents" file:@""
modalForWindow:dictionaryWindow modalDelegate:self didEndSelector:sel
contextInfo:nil];
    NSLog(@"Open Dialog Loaded");
}

---

The window would show, but that's it.  The program never gets to the
NSLog part.  Does anyone have any ideas why it is like this?

Thanks,

Darwin
Peter Ammon - 20 Oct 2005 18:56 GMT
> I'm quite new at cocoa and programming in general, am I got stuck with
> trying to get open dialogs to work.  Here's the problem:
[quoted text clipped - 7 lines]
>     [openPanel beginSheetForDirectory:@"~/Documents" file:@""
> modalForWindow:dictionaryWindow modalDelegate:self didEndSelector:sel
  ^^^^^                           ^^^^^

Those are your clues that this is a modal operation - that is, it blocks
until it completes.

> contextInfo:nil];
>     NSLog(@"Open Dialog Loaded");
[quoted text clipped - 8 lines]
>
> Darwin

If you want your code to continue before the open panel session is
completed, use the modeless counterpart, -[NSOpenPanel
beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:]

-Peter

Signature

Pull out a splinter to reply.

Darwin Darakananda - 22 Oct 2005 04:58 GMT
Thanks, but do you mind explaining what is the difference between the
two and how I can use the modeless counterpart?  I'm a bit confused on
what argument is required.  Sorry, I'm completely new at this, this can
be fustrating.

Thanks again,

Darwin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.