Cocoa question for you old guys
Cocoa question for you old guys
- Subject: Cocoa question for you old guys
- From: arekkusu <email@hidden>
- Date: Tue, 10 Jun 2003 15:51:33 -0700
On Monday, June 9, 2003, at 04:33 PM, <email@hidden> wrote:
>
On Monday, June 9, 2003, at 06:20 PM, Niko Matsakis wrote:
>
> I only wish Cocoa was so easy and transparent that we really had
>
> nothing
>
> better to do on this list than argue about whether '==' or 'is' is
>
> easier on the eyes.
>
>
OK. Lets hear your Cocoa problem.
>
>
give us something to chew on :-)
All right, here's my unanswered question from last week. Any takers?
(Problems subclassing NSSlider)
I need a slider that allows selection of a range (like the Quicktime
position slider.) After looking at ProgressViewPalette, Stick
Software's Circular Slider, and the IB palette tutorial on
cocoadevcentral, I have things mostly working, but there are a few
issues that I'm stuck on. I'm hoping somebody can clue me in...
My approach is:
* Subclass NSSliderCell to draw a custom knob (two knobs connected by a
bar) via drawWithFrame:: (just getting the controlView size) and
drawKnob: (doing the actual work) as well as custom mouse tracking via
startTrackingAt::, continueTracking:::, and stopTracking::::. There's
also the usual coder and accessor methods for my minRange and maxRange
ivars.
* Subclass NSSlider to setCellClass: appropriately (so I can mix with
regular NSSliders) and patch to the cell's methods.
* Create a Palette and Inspector class, and a little test harness (just
awakeFromNib), so I can add controls either in a nib using IB or
programatically and test the results.
With this, the basic slider interaction, display, and API is all pretty
much working. But:
Problem 1:
The slider is still doing it's own tracking and invalidation for the
default knobRect, when I call [super startTrackingAt::] or [super
continueTracking:::]. It also seems to update the doubleValue then,
before drawWithFrame:: is called. I just ignore the default knobRect
and do my drawing and invalidation, but this feels like a hack. The
value is a problem because, although I can reset it to what I want (the
midpoint between min/max ranges) during the draw, that is too late for
other controls using takeFloatValueFrom:. How can I force the default
machinery to use my rect and doubleValue throughout?
Problem 2:
In IB, my inspector has the same Continuous and Enabled checkboxes as
the normal sliders. When I check them, my control is never sent a
redraw message, UNLESS I've previously resized it, or manipulated
another control first. Sending [selectedView updateCell:] or
[selectedView setNeedsDisplay:YES] doesn't force display either. What
am I missing here?
Problem 3:
With Accessibility turned on, the focus ring around my custom knob
looks wrong. I draw the knob in three pieces (left and right knob
images, and a bar connecting them) and the blue focus glow is leaking
through where the images connect. It's as if it's computed three focus
rings instead of one. How can I get the correct focus ring?
Problem 4:
Also with Accessibility, if I run UI Element Inspector, I can see that
the hittesting for my knob is limited to the default knobRect (see
problem 1). Even if the knobRect was correct though, what I probably
want is two AXValueIndicators in one cell. How can I set this up?
Thanks for any and all help. As always, pointers toward more sample
code is best. :)
_______________________________________________
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.