NSApp Sheets question in cocoa

Posted by califguy on Stack Overflow See other posts from Stack Overflow or by califguy
Published on 2010-05-26T00:07:55Z Indexed on 2010/05/26 0:11 UTC
Read the original article Hit count: 219

Filed under:

Hi, Here's what I am trying to do. I need to prompt the user for a password prompt and until he enters the password and hits, say the Enter button on the sheet, I want to prevent the code being parsed in the background. Here's the code to run the sheet and when the user enters the password and hits Enter, endSpeedSheet is run. I am calling all of this from my Main() function.

What I am noticing is that the when the main function runs, the sheet shows up, the user is prompted for a password. But in the background, I already see " Code gets here" has been run. This means the code has already run in the background. What I need is the code to wait at the password prompt and then use this password after the Sheet has been dismissed. Any idea's on what I am missing here ?

     - (IBAction) showSpeedSheet:(id)sender
    {

       [NSApp beginSheet:speedSheet
    modalForWindow:(NSWindow *)window
    modalDelegate:nil
    didEndSelector:nil
    contextInfo:nil];

    }

    -(IBAction)endSpeedSheet:(id)sender
    {
 joinPassword = [joinPasswordLabel stringValue];
 [NSApp endSheet:speedSheet];
 [speedSheet orderOut:sender];


    }


    -(IBAction)main:(id)sender
   { 
      [self showSpeedSheet:(id)sender];
      // More Code here
      NSLog(@" Code gets here");

   }

© Stack Overflow or respective owner

Related posts about cocoa