Dynamically Resize NSView Subclass to NSScrollView
Dynamically Resize NSView Subclass to NSScrollView
- Subject: Dynamically Resize NSView Subclass to NSScrollView
- From: Mijobe <email@hidden>
- Date: Sat, 24 Jan 2004 17:26:05 -0500
I am developing a drawing application that allows users to draw
arbitrary shapes onto a canvas, very similar to Apple's Sketch example
application. I would like the size of the canvas to follow the size of
its containing NSScrollView as long as it is large enough to display
the contents of the canvas. If the NSScrollView is shrunk below the
amount of space needed to display the graphics then I would like the
canvas to stop resizing allowing the scrollbars to appear. To clarify
here are a few example scenarios of how I would like it to work:
- The user requires more canvas surface for their graphics and so they
resize the window to fit the additional content. As the window is
enlarged the NSScrollView is enlarge and the NSView follows in suit by
enlarging its drawing surface.
- The user has drawn all of the graphics for a particular canvas and
doesn't want the window taking up all of their desktop space but wants
to work with particular sections of the canvas so they shrink the
window smaller than the space required by the canvas to display all the
graphics. Once the size becomes too small to display all of the
graphics the NSView stops resizing and the NSScrollView then displays
its scrollbars allowing the user to scroll over the canvas.
My question is what is the best approach for coding this? For example
should my NSView subclass listen for events from the NSScrollView or
should I write an NSScrollView subclass that manages the size of the
NSView in some fashion, etc. Thanks in advance.
-
email@hidden
<xinjen/>
_______________________________________________
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.