On May 1, 2009, at 3:20 , DairyKnight wrote:

I'm trying to build a simple scribble program with Cocoa, and got some
questions I couldn't solve. Hope someone here could help.

   1. How can I perform a proper drawing in somewhere else rather than
drawRect: ? Like the Win32 GetDC(HWND) and ReleaseDC. (Sorry I'd use lots of
Win32 analogy, coz

You almost certainly don't want to do that, especially not if you can't get the normal version (using drawRect:) to work yet...

I've been a Win32 developer for quite a while.)
2. In the program what I did was respond to mouseDrag and call [NSView display]. In drawRect I draw all the scribble lines using [NSBezierPath
strokeLineFromPoint]
But it seems the Mac Windows Manager would automatically clean out the whole drawing area. Is there a way to avoid this? Like the InvalidRect(HWND, 0,
FALSE) in Win32.

Your drawRect: needs to completely draw the view, from what you describe it sounds like you're trying to use drawRect: to draw your scribbles incrementally. That won't work, at least not like this.

Marcel

_______________________________________________

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