Positioning issues with NSViewComponent


I have a NSTextField as the view in a NSViewComponent which is added to a Component (i.e. Component->NSViewComponent->NSTextField)

When the main window resizes I need to move the Component for correct GUI alignment (aligned top right in main window), but the NSTextField moves around a bit (i.e. not staying within the Component). Specifically when the main window is resized in height.

Any idea what might cause this?


Perhaps some int/float rounding issue? NSRects are all float coords, yes? Or are you talking about major movement? (Although it could still be related.)


Oh yeah, major movement. If I resize with +100 pixels in height, the NSTextField might get 100 pixels from where it should be. Cocoa has window position 0,0 bottom left, whereas Carbon had 0,0 at top left. Don’t know if that has anything to do with it…


sounds like a resize issue I was having in AUs


yep, that’ll be it.


Ok then, is it something I’ve done wrong or a bug in the NSView wrapper component? I haven’t done much more than plug the NSTextField into the NSViewComponent, pretty much as I’d have with any other component…



textField=[[NSTextField alloc]initWithFrame:NSMakeRect(0,0,100,100)];
[textField setAutoresizingMask:NSViewMinYMargin];




Thnx Justin, that did the trick! :slight_smile: