BSD

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • NSApp runModalSession: problem

    0 answers - 2402 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi All,
    I have a modal progress dialog that I present while waiting for a library to
    finish a long running operation. The library periodically calls an idle
    proc. In my idle proc, I use NSApp runModalSession: to run the progress
    dialog.
    The problem is that if I move the dialog window by dragging the window title
    bar, controls within the progress dialog no longer respond to mouse clicks.
    Specifically, I can no longer click in a Cancel button. Interestingly, the
    button continues to respond to keyboard events (Command-.).
    The dialog window is an NSPanel loaded from a nib file. This happens on
    both Panther and Tiger systems. Does anyone have any ideas what I might be
    doing wrong?
    Here's the code that displays and runs the progress dialog:
    - (void) showProgress
    {
    if (!mVisible)
    {
    mInterrupted = N;
    if (!mStartDate)
    mStartDate = [[NSDate alloc] init];
    else if (mStartDate && [[NSDate date]
    ] >= kShowInterval)
    {
    [mStartDate release];
    mStartDate = nil;
    [mInterrupt setEnabled:YES];
    [mProgress startAnimation:self];
    mModalSession = [NSApp ];
    [mWindow makeKeyAFront:self];
    mVisible = YES;
    }
    }
    }
    - (void) runProgress
    {
    if (mVisible)
    {
    if (!mLastRun || [mLastRun timeIntervalSinceNow] < -kRunInterval)
    {
    int r = [NSApp runModalSession:mModalSession];
    if (r != NSRunContinuesResponse)
    {
    #ifdef DEBUG
    NSLog(@"progress: %d", r);
    #endif
    }
    [mLastRun release];
    mLastRun = [[NSDate date] retain];
    }
    }
    }
    - (void) hideProgress
    {
    if (mVisible)
    {
    [mProgress stopAnimation:self];
    [NSApp endModalSession:mModalSession];
    [mWindow :self];
    mVisible = N;
    }
    [mLastRun release];
    mLastRun = nil;
    [mStartDate release];
    mStartDate = nil;
    }
    Cheers
    -Mark
    Mark Alldritt Late Night Software Ltd.
    Phone: 250-380-1725 Script Debugger 3.0 - AppleScript IDE
    WEB: http://www.latenightsw.com/ FaceSpan 4.2 - AppleScript RAD
    Affrus 1.0 - Perl Debugging
    Do not post admin requests to the list. They will be ignored.
    Cocoa-dev mailing list (Cocoa-dev (AT) lists (DOT) apple.com)
    Help/Unsubscribe/Update your Subscription:
    %40developershed.com
    This email sent to bsdarchive (AT) developershed (DOT) com

Re: NSApp runModalSession: problem


max 4000 letters.
Your nickname that display:
In order to stop the spam: 2 + 2 =
QUESTION ON "BSD"

EMSDN.COM