Skip navigation.
 
mlRe: NSRect/NSButton bug?
FROM : j o a r
DATE : Sun Nov 24 14:56:01 2002

You cannot set the NSRect of a button, because it doesn't have such a
property. The property you're thinking about is called the "frame" of
the button.

In IB you have something called "Layout Rect", but this is not
corresponding to the frame of the button. The Layout Rect is used to
help you to get proper Aqua spacing of the controls - via the
"snap-to-guides" that appear automatically. The Layout Rect is an IB
only property that you cannot reference in the running application.

In the Inspector in IB you can choose if you want to see the
coordinates of the Layout Rects or the frames of the selected controls
- use the pop up menu in the size inspector to switch between the two.
My guess is that you have been looking at the Layout Rect coordinates
rather than the frame, and hence got confused.

j o a r


On Sunday, Nov 24, 2002, at 21:15 Europe/Stockholm, Colin Cornaby wrote:

> Hello, I am trying to set the NSRect of a NSButton but I've run into
> what looks like a bug (or a "feature").
>
> In IB (using bottom, left) the button has a y co-ord of 24. Until you
> change the co-ord [authtext frame].origin.y will nicely read it as 24.
>
> Here is where it gets freaky. If I set the y co-ord to 24, the button
> will actually move up 4 pixels on screen. If I set the y co-ord to 20
> the button will stay put. When I set it to 20 [authtext
> frame].origin.y will begin reading it as 20 even though it was at 24
> before and the button did not physically move.
>
> This means if I run the code [authtext
> setFrame:NSMakeRect(49,[authtext frame].origin.y,i,21)] the buttons y
> co-ord will actually move even though I am setting the y co-ord to
> itself!
>
> Is there any explanation for this?



Related mailsAuthorDate
mlNSRect/NSButton bug? Colin Cornaby Nov 24, 12:23
mlRe: NSRect/NSButton bug? j o a r Nov 24, 14:56
mlRe: NSRect/NSButton bug? Colin Cornaby Nov 24, 15:20
mlRe: NSRect/NSButton bug? j o a r Nov 24, 22:27