• 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
Faking out modality with validateMenuItem:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Faking out modality with validateMenuItem:


  • Subject: Faking out modality with validateMenuItem:
  • From: Jeffrey Johnson <email@hidden>
  • Date: Tue, 5 Dec 2006 10:24:12 -0500

Hello,

  I'm getting deeper and deeper into trouble with fighting modality in Cocoa, and I need help.

This app makes heavy use of WebViews, and uses the NSDocument structure.

  We have an app where one of the requirements is to type in a registration code the very first time the app is launched. The registration code is sent to a web server and validated. I really need a modal sheet or dialog to do this.

I thought I could just start the app, bring up the initial document window, and in the window controller's windowDidLoad:, put up a window to handle the registration info with a [NSApp runModalForWindow:[myRegWindow window]].

Alas, NSURLConnection is broken for modality- you (or your WebView) can make outbound NSURLConnections while modal, but as long as modality is "on", your connection:didRecieveXXX callbacks will never be called, even if the delegate to handle those requests is the modal window- apparently the modal filter discards the incoming results. This has been known about for at least three years, by searching the list archives.

So I abandoned the runModalForWindow: approach entirely and decided I'd put up a view with the registration controls covering the content in the initial window, and try to fake modality by disabling the menu items myself. That solved the modality problem with NSURLConnection, but by adding a validateMenuItem: to my AppController to disable menu choices during registration, it interferes with the normal way menus are handled after registration.

This is starting to smell like a hack upon a hack. Does anyone have suggestions on how I can simulate modality without completely screwing up our design, or put up another "document" window on startup that isn't really a document? (And, no, "not requiring registration" is not an option.)


Thanks
Jeffrey Johnson
Macintosh Development
Wavefunction, Inc.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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

  • Follow-Ups:
    • Re: Faking out modality with validateMenuItem:
      • From: glenn andreas <email@hidden>
  • Prev by Date: Re: Synchronizing Thread Execution
  • Next by Date: Re: Synchronizing Thread Execution
  • Previous by thread: Re: Re: Sub classing.
  • Next by thread: Re: Faking out modality with validateMenuItem:
  • Index(es):
    • Date
    • Thread