objective c - Attaching a sheet the first time -


i'm writing application needs read data off smartcard. due way smartcards work, operation take few seconds during time updates display it's read far, isn't going responsive yet until everything's read; so, avoid confusion, want show sheet spinner , text "reading data card..." user knows what's going on.

in xib, i've created new window containing spinner , nstextfield. when try show sheet, following:

[[nsoperationqueue mainqueue] addoperationwithblock:^{     [_spinner startanimation:self];     [nsapp beginsheet:_cardreadsheet modalforwindow:_window modaldelegate:self             didendselector:@selector(endsheet:returncode:contextinfo:) contextinfo:nil]; }]; 

and later on, when state machine indicates we've finished reading, do:

[[nsoperationqueue mainqueue] addoperationwithblock:^{     [nsapp endsheet:_cardreadsheet];     [_spinner stopanimation:self]; }]; 

there a

- (void) endsheet:(nswindow*)sheet returncode:(nsinteger)returncode contextinfo:(void*)ctxinfo {     [sheet orderout:self]; } 

where _cardreadsheet sheet want display, _window window want attach sheet, , _spinner circular progress indicator.

this seems work fine second time; is, if start application, read data off card, remove card reader, , read again, works okay.

the first time around however, rather showing sheet attached main window, shows cardreadsheet top-level window on location seems specified in xib file, , [sheet orderout:self] line has no effect (the window remains on-screen).

what missing?

make sure isn't visible @ launch or other weird option set

enter image description here


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -