• 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: David Borland <email@hidden>
  • Date: Sun, 9 Oct 2005 12:14:06 -0700

I've seen that suggestion in the archives, but I haven't figured out what I'm supposed to do with sizeToFit.

I tried changing the method so that it just wrote out to the console when it gets called and what the frame is at that time, and it wasn't being called automatically, and when I called it explicitly, the frame was what it was supposed to be.

I should mention that in Interface Builder I'm putting a custom view of the size I want, and then setting the custom class to be subclass, in case that changes anything.

David Borland
Electrical Geodesics, Inc


On Oct 8, 2005, at 9:10 AM, Ryan Stevens wrote:

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
References: 
 >NSSliderCell Drawing Issue (From: David Borland <email@hidden>)
 >Re: NSSliderCell Drawing Issue (From: Ryan Stevens <email@hidden>)

  • Prev by Date: Re: Creating a custom rating control
  • Next by Date: NSTextView & HTML table height?
  • Previous by thread: Re: NSSliderCell Drawing Issue
  • Next by thread: Bindings and Core Data question.
  • Index(es):
    • Date
    • Thread