[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug with addSubview ??

From: Paddy Smith
Subject: Re: bug with addSubview ??
Date: Sat, 10 Feb 2007 14:46:55 +0000

On 2/10/07, Richard Frith-Macdonald <address@hidden> wrote:

On 10 Feb 2007, at 11:23, Paddy Smith wrote:

> Hi,
> The upper textfield appears a long way from where I expect it
> (off the window initially, have to resize to see it).
> Is this just a bug or am I doing something silly ?

I think probably something silly ... bear in mind that a views
coordinates are relative to the view it is placed in.
I suspect that you meant the coordinates for the textfield to be
pad,pad rather than r.origin.x+pad,r.origin.y+pad

D'oh!  I really thought I'd checked that the origins coming in there were 0,0.
I just figured I'd want them if I moved to another frame of reference (like
if I ditch views).

So the NSRect that is passed in is the frame in terms of the containing
coordinates (which makes sense I suppose, otherwise you could just send
a size :-)) and what it buys you is precisely what I'm trying to do(!), the
ability to draw directly in the view, which is done in terms of *that*
system.  And the view having its own frame of reference is more or less just
sugar that makes it a handy weapon to point at your feet ;-)

My consistency hobgoblin is now hopping from foot to foot :-)))

Thank you, thank you very much!  That was something I wasn't going to see
even though it was staring me in the face! :-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]