Based upon a recommendation that I found, I changed up code from running a modal dialog to use beginModalSessionForWindow and runModalSession. Unfortunately, if I run an NSOpenPanel from within this (used for a browse for a target directory), runModalSession for *my* dialog returns the 0 or 1 off the open panel as soon as that closes, thus (with my expected handling) closing my dialog as well. I checked and none of my stopModalWithCodes are being fired, so the result code has to be coming off the system dialog. I did a kludge where I used 100 and 101 for my own stop codes, and continued on 0 and 1, and that seemed to work around this, but I would really like to understand what is wrong with this setup.
Best regards, Tom Doan --- 1560 Sherman Ave #1029 Evanston, IL 60201 USA #if 0 // // Original code // itsRC = (LOGICAL) ([NSApp runModalForWindow:itsDialog->GetDlgWnd()]); #else // // Code which gives main loop time // NSModalSession session = [NSApp beginModalSessionForWindow:itsDialog->GetDlgWnd()]; int result = NSModalResponseContinue; while (result == NSModalResponseContinue) { //run the modal session //once the modal window finishes, it will return a different result and break out of the loop result = [NSApp runModalSession:session]; //this gives the main run loop some time so your other code processes [[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode]; //do some other non-intensive task if necessary } [NSApp endModalSession:session]; itsRC = (LOGICAL) (result); #endif _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com