Re: My Slider has spikes
Re: My Slider has spikes
- Subject: Re: My Slider has spikes
- From: Ron Fleckner <email@hidden>
- Date: Fri, 13 Apr 2007 11:01:49 +1000
On 13/04/2007, at 10:35 AM, Murat Konar wrote:
I'll bet it has something to do with whether
On Apr 12, 2007, at 5:26 PM, Ron Fleckner wrote:
I make a popup window for a slider in my app. My problem is that
the slider has strange little barbs or spikes near the ends of
it's 'track' and the ends of the track are squared off rather than
rounded. Here's the whole code I use to create the window...
[snip]
First of all, why not use Interface Builder to construct your view
hierarchy then pop that into your custom window?
Second, I'll bet what's going on is that the end caps of your
slider's groove are being drawn upside down, which suggests a
problem somewhere with coordinates not having the proper flipped-ness.
_murat
Yes, yes, that's it! It's fixable. Flipped-ness is surely the
culprit. I've set my slider subclass to return NO as I wanted to
easily track the mouse position and move the slider as the mouse
moved so the user doesn't have to click and drag. However, if my
slider returns YES for -isFlipped, I get a comical situation where
the slider moves in the opposite direction to the mouse, but at least
the spikes have gone. Well spotted, Murat.
What I'm trying to do:
Have the slider move in concert with the mouse without having to
click and drag. The slider reads -mouseMoved: events while it's on
screen and sets it's value (knob position) according to the mouse's
position. There probably is a way to get the mouse position and set
the slider's value in the -isFlipped YES situation, but my maths is
not good. By setting -isFlipped to NO, I can simply use the
location.y of the -mouseMoved: event.
The reason I used code and not IB was because IB wouldn't let me make
the window narrow enough for my purposes. There probably is a way to
do it in IB, but rather than research the answer, it seemed simpler
and quicker to just write that fairly small bit of code.
Ron
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden