I am looking for some simple, simple example of how to work with a pair of NSScrollers in NSScrollView with a custom NSView.
There are sporadic examples, mainly consisting of far-fetched examples using programmatically created interfaces or based on the assumption that the developer is working with a typical ImageView or TextView. Even the Sketch example is based on NSView, which uses the Page Setup option in the Print dialog box for borders, and everything is managed using Cocoa. So there are no real discussions or examples anywhere on how to make it all work with a custom model (although this may be part of the problem, because what is the model based on?). Even Apple documentation itself is mocking here.
Essentially, I have a subclassified NSView built into NSScrollView (in the Scoll viewing guide) that the user can click in the view to create, edit and delete objects, like an illustration program. A model is those objects that are just data wrappers that simply record their position for drawRect: for use. Height and width are based on custom values, which are converted to pixels as needed.
My problem is that all the examples I found are based either on a text editor, or on an image viewer, or on the standard size of the document in the Page Setup dialog box. Since these are common types of documents, Cocoa basically controls the developer, so the interaction code is more or less hidden (or I just donβt see it for what it is). My project does not meet any of these needs, and I do not need to print. Losing my model in the documentView property will fail.
, NSScrollers - (documentView) , , . , , , , .
( , Cocoa, REALbasic, MaxX, MaxY ScrollBar Maximum, , ScrollBar, . NSScrollers NSScrollView .)
, , , . , , Apple , , , - ...
, NSDocument, , drawRect, . Sketch. Sketch " " , . Cocoa , ScrollView, , NSDocument, ? NSRect NSScrollView? ? NSView, NSScrollView NSDocument init? NSScrollView ( ), , Builder, . .
, " ", . , MIDI- .
( ):
, , , , .
NRect DocumentRect, NSRect . NSView
[self setFrame:[[self EditorDocument] DocumentRect]];
, , , . , , , .
, (documentView, , NSView), . .