On Sun, Jan 17, 2010 at 1:59 PM, Per Bull Holmen <[email protected]> wrote:
> Is it possible, in Cocoa, do program a loop which goes something like this:
>
> for i=1 to 20
> do something
> block for GUI user input
> do something with the input
> repeat

This is a bad idea. Don't block the UI thread, because then the user
will see a beachball.

Sounds like you need to reread the Cocoa Event Handling Guide:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/EventOverview/Introduction/Introduction.html

Your architectural difficulties also betray an unfamiliarity with MVC
design. I suggest you read the Cocoa Design Patterns section of the
Cocoa Fundamentals Guide, delve into the AppKit classes to see how
that document relates to the actual framework, and then iterate your
own design over and over (perhaps with pencil and paper for a while),
keeping in mind the things you've learned from the documentation and
from using the classes in AppKit. AppKit classes need to maintain a
lot of state information, particularly when doing things like dragging
or other input-driven processes. Here is the relevant document:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/CocoaDesignPatterns.html#//apple_ref/doc/uid/TP40002974-CH6-SW6

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to