Question

I've been trying to understand the docs for NSWindow,NSView,NSBox,NSCollection in order to make the best choice for my project, but I think I'm missing some things.

I need to display 6 items, in a group; each item consists of a (fixed name)label, slider, and (variable) label. They control plots in an adjacent NSView.

I could simply plunk them down individually in a window or a custom view; no more work except for hooking them up. So far I see no real advantage to either one and either will display the groups and function correctly.

With what seems to me to be a substantial amount of extra work, especially dealing with poor documentation, I could make an NSCollection or an NSBox. An NSCollection would enforce fixed locations and possibly facilitate additions or deletions, which I don't expect to do. With the NSBox, locations are flexible and I see that I can drag the box and move the whole group if I ever have to. Otherwise, I fail to see any advantages. Can anyone "sell" me some things I can do with them that might be useful?

But I keep wondering: if the Window and View are so easy, why does anyone bother with collections and boxes? Just because they're pretty, in some sense?

Was it helpful?

Solution

In cocoa-dev@lists.apple.com, Graham Cox answers a similar question for someone who wants a set of 4 vertical sliders:
" . . . just make a custom view for your custom slider, then add it four times to another custom view that handles the "set" of sliders as needed."
Close enough. This sounds easiest to me, so I'm using it. But I'll still learn about NSCollection, etc. when time permits.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top