Hi Alexander

> I tried to achieve the next effect: some automatic process should be started 
> on the modal window appearance on screen. A popup panel with progress 
> indicator appears, etc. My idea was not to initiate such process from the 
> calling code (where modal window is called from), but do it asynchronously, 
> as soon as the modal window will appear on the screen.

I'm not sure if you realise how the MVC design pattern works. A window is just 
a view on data, it has no state or logic at all.

> Of course, I've solved the problem by calling this process from the calling 
> code just before [NSApp runModalForWindow:] call. But it is not pretty 
> correct from the OOP philosophy point of view, at least as I understand it.

Every window is "managed" by a Controller and it is from this Controller that 
you can run any process you want, as well as creating and showing a window.

There is nothing wrong with calling a process from a controller class; you can 
set to run in a secondary thread and display a progress indicator.

> What is over my mind is why Apple split main loop and modal loop. I see none 
> of benefits but headaches.. There may be only one modal window at a time, 
> isn't it?

I think you are used to Windows programming. Cocoa modal sheets are modal to 
the owning form, not the whole app.

Joanna

--
Joanna Carter
Carter Consulting

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to