FROM : Colin Cornaby
DATE : Sun Nov 24 15:20:02 2002
The problem is if I set the y co-ord of the frame to itself the
placement of the rect changes on screen. This just doesn't make sense.
Maybe I should put together a demo project to show this.
---------------------------------------
Colin Cornaby
Official Cocoa Newbie for RBDeveloper Magazine
Head Person, Conundrum Software, www.conundrumsoft.com
On Sunday, November 24, 2002, at 02:54 PM, j o a r wrote:
> 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?
>
>
DATE : Sun Nov 24 15:20:02 2002
The problem is if I set the y co-ord of the frame to itself the
placement of the rect changes on screen. This just doesn't make sense.
Maybe I should put together a demo project to show this.
---------------------------------------
Colin Cornaby
Official Cocoa Newbie for RBDeveloper Magazine
Head Person, Conundrum Software, www.conundrumsoft.com
On Sunday, November 24, 2002, at 02:54 PM, j o a r wrote:
> 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 mails | Author | Date |
|---|---|---|
| Colin Cornaby | Nov 24, 12:23 | |
| j o a r | Nov 24, 14:56 | |
| Colin Cornaby | Nov 24, 15:20 | |
| j o a r | Nov 24, 22:27 |






Cocoa mail archive

