RE: Drawing graphics into a view in AppleScript Studio
RE: Drawing graphics into a view in AppleScript Studio
- Subject: RE: Drawing graphics into a view in AppleScript Studio
- From: Kerry Hazelgren <email@hidden>
- Date: Sat, 17 Jan 2004 00:29:32 -0700
I can pass the window object to Cocoa, get the view, lockFocus, draw
some stuff, and unlockFocus. I've verified that the window and view
objects are the correct ones and that the lock and unlock is on the
expected view. I've even seen flashes of my graphics when I fiddle
with window fundamentals such as buffering, so I know my drawing is
there and in the right spot, but a stable drawing never appears in
the window.
In order to have a 'stable' drawing appear in a view it should be drawn
by overriding the -drawRect function of the view. That way, it is
drawn every time the view is invalidated, not just when you manually
draw into it by locking focus on it. In fact, you may lock focus on it
and draw into it, but the next time it is invalidated (which may be
immediately afterwards), it is going to be erased. I suspect this is
why you are just seeing flashes of your drawing.
It is not possible to use AppleScript to draw into a view, as there are
no suitable commands for it, but AppleScript Studio is really just
Xcode with support for AppleScript thrown in, so why not use the
standard Xcode/IB process for creating, overriding, and drawing into a
view?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.