Reputation: 420
Issue1: I want to show an alert window or message box before the Main Window of the Application is launched. When im using the NSRunAlertPanel() it is not showing the alert window.It is directly launching the Application's Main Window.
Issue2: I want to create an Modal (login dialog) and message boxes in an thread spanned from the main thread.
Its urgent
So, Kindly reply soon...
Thank You Pradeep.
Upvotes: 1
Views: 1302
Reputation: 96333
Issue2: I want to create an Modal (login dialog) and message boxes in an thread spanned from the main thread.
In Cocoa, nearly all UI code must run on the main thread. There are a few limited, well-defined exceptions (e.g., the opt-in threaded drawing introduced in Snow Leopard), but the general rule is to not run UI code on another thread.
Besides, you don't need a thread anyway. It's not like the modal dialog is going to be computationally intensive.
Send NSApp a runModalForWindow:
message, passing the dialog. This will run the dialog on the main thread, blocking the rest of your UI. If you don't want to block the UI (and you generally shouldn't), just make it key and order it front, like usual.
Upvotes: 3
Reputation: 27889
What you can do is:
Upvotes: 0