• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Drawing graphics into a view in AppleScript Studio
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Prev by Date: Re: Is my computer connected to the web?
  • Next by Date: FileWrappers
  • Previous by thread: Re: Drawing graphics into a view in AppleScript Studio
  • Next by thread: How Can i make my View as Sticky
  • Index(es):
    • Date
    • Thread