Report-an-Apple-Bug Friday! 57

2007-04-27 15:22:16 -08:00

This bug is NSFrameRectWithWidth uses the current color, not the stroke color. It was filed on 2007-04-27 at 16:17 PDT.


NSFrameRectWithWidth uses the “current color” (set by -[NSColor set]), not the stroke color (set by -[NSColor setStroke]), for the frame.

Steps to Reproduce:

  1. Set the stroke color by sending -setStroke to some NSColor.
  2. Call NSFrameRectWithWidth with any valid rect and any width.

Expected Results:

The frame is drawn in the color that was set as the stroke color.

Actual Results:

You can have a frame in any color you want, as long as it’s black. (Or whatever color was last set as the current color by sending -set to it, rather than -setStroke.)


None known.


Use -set instead of -setStroke.


I realize that technically, NSFrameRect is not a strokeā€”a stroke is centered on the line, with half inside and half outside, whereas a frame is entirely inside the line. But they are so similar that I expected this to work. In my opinion, the expectation is reasonable and NSFrameRect should use the stroke color when it’s been set.

A test app is attached. The left side uses -set; the right side uses -setStroke. Notice how the frame on the right side is always black, no matter what color you set in the right-side color well.

One Response to “Report-an-Apple-Bug Friday! 57”

  1. Scott Stevenson Says:

    I think changing this now would probably cause more confusion than it would prevent.

Leave a Reply

Do not delete the second sentence.

Warning: Undefined array key "ntt_saved_comment_text" in /home/public/blog/wp-content/plugins/negative-turing-test/negative-turing-test.php on line 143