I sometimes find that trying to subclass existing classes such as NSCell is more trouble that it's worth, unless you really need your custom cell to be used anywhere a cell can be used, e.g. buttons, matrices, list rows, etc.
If you just want a particular custom control that doesn't need that degree of reusability, subclassing NSView or NSControl is always a lot easier. In this case, if NSSlider isn't suitable, 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. --Graham On 16/02/2013, at 7:30 AM, Steve Mills <[email protected]> wrote: > On Feb 15, 2013, at 13:35:38, Steve Mills <[email protected]> wrote: > >> What's the easiest way to create a custom control that contains a matrix of >> 4 custom vertical sliders, like a mini graphic EQ? The sliders will not draw >> the slot, only the knob. First I started with a subclass of NSMatrix and a >> subclass of NSCell. No matter what I've tried, the cells always end up >> drawing at the wrong size, as if they were the cell for a simple text >> matrix, about 100 pixels wide and the height of a regular size text label. I >> create it thusly: >> >> MyMatrix* blView = [[MyMatrix alloc] >> initWithFrame:NSMakeRect(100, 100, 200, 80) mode:NSTrackModeMatrix >> cellClass:[MyCell class] numberOfRows:1 numberOfColumns:4]; >> >> I've tried overriding all sorts of methods in the 2 subclasses; cellSize, >> cellFrameAtRow:column, even returning a cellSize of 10000,10000 as suggested >> in the docs for cells that aren't text or image cells. > > > Addendum: > > If any of the sliders is dragged past the top of bottom of the containing > control, the containing control's bounds will be expanded live in that > direction, thereby keeping the mouse within the containing control. I'm > starting to think that doing with this a matrix of cells won't be the best > way to do this, but rather just create a custom control and tracks the 4 > "sliders" internally. Thoughts? _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
