• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSAlert - multiple key equivalents for buttons?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAlert - multiple key equivalents for buttons?


  • Subject: Re: NSAlert - multiple key equivalents for buttons?
  • From: David Reitter <email@hidden>
  • Date: Wed, 7 Oct 2009 15:23:03 -0400

On Oct 7, 2009, at 3:12 PM, Kyle Sluder wrote:

FWIW, the alerts are run with beginModalSessionForWindow and
runModalSession.

So I don't understand why you're so intent on using NSAlert if you're not using its -beginSheetModalForWindow:… convenience method?

Oh, I use it. But because of the design of the rest of the application, the sheet still has to run as application modal.


The code handling both sheet and non-sheet alerts, both in application global mode, is about as follows:

  if (useSheet) [dialog beginSheetModalForWindow:...
			didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
			 ...];

  session = [NSApp beginModalSessionForWindow: [dialog window]];

NSInteger ret1 == -1, ret2 = -1;
while (ret == -1
&& ((ret2 = [NSApp runModalSession: session])
== NSRunContinuesResponse))
{
/* some background tasks */
[NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]];
}
if (ret == -1 && ret2 != -1)
ret = ret2;



note that alertDidEnd sets my "ret" variable. I can't use runModal: because I need to do some background tasks.


The above technique works quite well for all practical intents and purposes. I'm aware that application-modal window sheets aren't a generally good idea, but the sheets pertain specifically to the documents shown in the window, so they're a much better idea than application-modal alerts.

Would it be possible to add a control to the alert that is invisible, but
has the desired extra keyEquivalent?

Sure, if you feel like confusing all your accessibility and VoiceOver users with spurious invisible controls.

I see, that's a good point.
I also don't want to confuse my majority of other users with the lack of key bindings that they're used to...



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >NSAlert - multiple key equivalents for buttons? (From: David Reitter <email@hidden>)
 >Re: NSAlert - multiple key equivalents for buttons? (From: Jens Alfke <email@hidden>)
 >Re: NSAlert - multiple key equivalents for buttons? (From: David Reitter <email@hidden>)
 >Re: NSAlert - multiple key equivalents for buttons? (From: Kyle Sluder <email@hidden>)
 >Re: NSAlert - multiple key equivalents for buttons? (From: David Reitter <email@hidden>)
 >Re: NSAlert - multiple key equivalents for buttons? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Strange Core Data problem after upgrade
  • Next by Date: Re: Alert prompts for BetterAuthorizationService
  • Previous by thread: Re: NSAlert - multiple key equivalents for buttons?
  • Next by thread: EXC_BAD_ACCESS when -fobjc-gc is on (Was: Memory corruption ...)
  • Index(es):
    • Date
    • Thread