General NSView Query

  • Hi all,

    As part of a project I've been working on I have a simple drawing interface that allows the user to draw shapes/text in to an NSView.  One of the tools is a polygon tool -- the kind where you click at one point, then you click at another point and so on and so on until you double click and the polygon creation is ended and the points are all connected by lines.

    Now in an old Mac program (World Builder -- created in 1986) there was a polygon tool like I described above.  One of the things I liked about it was once you started a polygon shape, you could click outside of the window you were drawing in to add points to the polygon -- as if when a polygon was created control of the screen was taken over until it was finished.

    Is anything like this possible with cocoa/NSView?  The other option I'm considering is to set up two NSView's -- one which is the actual area that will be drawn to, and the other is a grey border area where you can click to create polygons but which will not display any shapes that may extend out of the first view.  I haven't actually tried to implement it yet, but that seems more feasible than the first option.

    Any thoughts would be appreciated!

    Thanks,
    Mike
  • On Wed, 26 Sep 2007 09:40:32 -0400, "Burns, Michael" <mburns...>
    said:
    > Hi all,
    >
    > As part of a project I've been working on I have a simple drawing interface
    that allows the user to draw shapes/text in to an NSView.  One of the tools is a
    polygon tool -- the kind where you click at one point, then you click at another
    point and so on and so on until you double click and the polygon creation is
    ended and the points are all connected by lines.
    >
    > Now in an old Mac program (World Builder -- created in 1986) there was a
    polygon tool like I described above.  One of the things I liked about it was
    once you started a polygon shape, you could click outside of the window you were
    drawing in to add points to the polygon -- as if when a polygon was created
    control of the screen was taken over until it was finished.
    >
    > Is anything like this possible with cocoa/NSView?

    You could cover the screen temporarily with a big invisible window to detect
    the clicks. m.

    --
    matt neuburg, phd = <matt...>, <http://www.tidbits.com/matt/>
    A fool + a tool + an autorelease pool = cool!
    One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
    AppleScript: the Definitive Guide - Second Edition!
    <http://www.amazon.com/gp/product/0596102119>
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today