Re: [NEWBIE] Sheets problem
Re: [NEWBIE] Sheets problem
- Subject: Re: [NEWBIE] Sheets problem
- From: Matthew Formica <email@hidden>
- Date: Tue, 26 Jun 2001 17:05:58 -0700
Sheets are certainly prettier, but in general in my opinion you don't want
to break the user experience of sheets. Sure, it's extra code to write, but
it's worth it. When I see a sheet on a window, I expect that I can continue
to use the rest of the app - setting preferences, opening help, maybe even
opening another file. So to block the whole app for a sheet will feel
weird, and go against the whole reason sheets were invented (reduction in
modality).
Matthew
on 6/26/01 12:06 PM, j o a r at email@hidden remarked:
>
Hi,
>
>
But what if you don't know that you will put up a sheet? In my case I am
>
comparing two large arrays, in rare cases I would need to ask the user
>
a question - but not nearly every time. If I can't run modal for
>
application then I need to write a lot more code, or loop over the
>
arrays again, to handle this case. It feels like a waste of time when it
>
would be so easy to solve if the sheet could simply halt the execution
>
when it is displayed.
>
>
Sure I could use a standard dialog, but sheets are prettier...
>
>
Regards,
>
>
j o a r
>
>
On tisdag, juni 26, 2001, at 06:22 , Brian Webster wrote:
>
>
> On Monday, June 25, 2001, at 07:45 PM, cocoa-dev-
>
> email@hidden wrote:
>
>
>
>> As I've said in another post, using only beginSheet, endSheet, and
>
>> orderOut, everything works properly.
>
>> But now, the problem is that the function which calls beginSheet:
>
>> should
>
>> return the sum of the int values of 2 text fields, and so should wait
>
>> until the sheet is closed, i.e. the user has validated the values that
>
>> he has entered into the fields.
>
>> Is there a way to do "wait until the sheet is closed" without
>
>> runModalForWindow ?
>
>
>
> Oh, I see what you want now. So do you have something along these
>
> lines?
>
>
>
> -(void)userActionThatNeedsToUseSheet:(id)sender
>
> {
>
> int inputValue;
>
>
>
> //do some stuff before running sheet
>
> inputValue = [self runSheetToGetValues];
>
> //do something with input value
>
> }
>
>
>
> -(int)runSheetToGetValues
>
> {
>
> [NSApp beginSheet:sheet ... etc.];
>
> return [textField1 intValue] + [textField2 intValue];
>
> }
>
>
>
> -(void)userActionThatEndsSheet:(id)sender
>
> {
>
> [NSApp endSheet:sheet];
>
> }
>
>
>
> If you do, and you really want to use a sheet, then this method won't
>
> work. You'll need to design it a little differently and put off
>
> handling the input values until the user dismisses the sheet, like so:
>
>
>
> -(void)userActionThatNeedsToUseSheet:(id)sender
>
> {
>
> //do some stuff before running sheet
>
> [self runSheetToGetValues];
>
> }
>
>
>
> -(void)runSheetToGetValues
>
> {
>
> [NSApp beginSheet:sheet ...];
>
> }
>
>
>
> -(void)userActionThatEndsSheet:(id)sender
>
> {
>
> int inputValue = [textField1 intValue] + [textField2 intValue];
>
> [NSApp endSheet:sheet];
>
> //do something with input value
>
> }
>
>
>
> Whatever code it is that actually does something with the input value
>
> needs to be put off until after the sheet is dismissed, it's not just a
>
> simple stack of function calls, since the user can do any number of
>
> things between the sheet starting and being dismissed.
>
>
>
> --
>
> Brian Webster
>
> email@hidden
>
> http://www.owlnet.rice.edu/~bwebster
>
> _______________________________________________
>
> cocoa-dev mailing list
>
> email@hidden
>
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev