• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSliderCell Drawing Issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSliderCell Drawing Issue


  • Subject: Re: NSSliderCell Drawing Issue
  • From: Ryan Stevens <email@hidden>
  • Date: Sat, 8 Oct 2005 09:10:04 -0700

NSControl, sizeToFit...

"Changes the width and the height of the receiver’s frame so they are the minimum needed to contain its cell."

On Oct 7, 2005, at 5:19 PM, David Borland wrote:

I'm trying to create a control that is a ruler that has a transparent control over it that shows what part of the ruler is actively being displayed in a view.

I've tried to create this controller by subclassing both NSSlider and NSScroller, and I can't get either of them to work. The problem in both cases appears to be because I want the control to be larger then a NSRegularControlSize control.

For the NSSlider attempt, I have these two methods in the RulerSliderCell class:

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
    [self drawRuler:cellFrame];

    cellFrame.origin.y += cellFrame.size.height - 20;
    cellFrame.size.height = 20;
    [super drawWithFrame:cellFrame inView:controlView];
}    /* drawWithFrame:inView: */

This draws my ruler and the slider grove at the bottom of the ruler.

-(void)drawKnob:(NSRect )knobRect
{
[[NSColor redColor] set];
[NSBezierPath fillRect:knobRect];
float height = knobRect.origin.y;
knobRect.origin.y = 0;
knobRect.size.height = height;
[NSBezierPath strokeRect:knobRect];
}
And this draws a red rectangle in the grove, and a hollow rectangle over the ruler when I start up the test application. The problem is that when I move the knob, the the rectangle in the grove moves, but the hollow rectangle stays put. It only gets drawn when resize the view or click out of the app.



In my NSScroller attempt, I have similar methods, and similar results. The extra thing that goes wrong with the NSScroller subclass is that it only responds to clicks in the area of that control that is NSRegularControlSize.



Any clues on how to fix either of my problems?


David Borland Electrical Geodesics, Inc



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSSliderCell Drawing Issue
      • From: David Borland <email@hidden>
References: 
 >NSSliderCell Drawing Issue (From: David Borland <email@hidden>)

  • Prev by Date: Problem solved: Dealing with non-standard character sets...
  • Next by Date: Fwd: Application suite architecture
  • Previous by thread: NSSliderCell Drawing Issue
  • Next by thread: Re: NSSliderCell Drawing Issue
  • Index(es):
    • Date
    • Thread