2
votes

I have created a custom NSWindow using:

self = [super initWithContentRect:contentRect styleMask:8 backing:bufferingType defer:flag];

Which handles resizing fine. However, it doesn't change the cursor when i hover over the borders. I could do this myself but i cannot create a trackingRect which goes beyond the edges of the window.

Any ideas how i could manage this would be great.

Thanks, Ben

2
Are you using -setMinSize: and/or -setMaxSize: or their "Content" variants? Does your delegate implement -windowWillResize:toSize:? According to the Lion AppKit release notes, there's no new API for the edge resizing and the above are the only factors which affect it. Also, you should use NSResizableWindowMask instead of the literal 8. In addition to being better practice, it would have made your question easier to follow. - Ken Thomases
I am using -setMinSize: but i am not using -windowWillResize:toSize:. Your absolutely right about the NSResizableWindowMask, thanks for responding. - BenJacob
Try setting a max size, too. Use something very large if you don't want it to really limit it. - Ken Thomases
No that doesn't affect the hover behaviour. - BenJacob
I know the release notes say it's a no-op, but can't hurt to try -setShowsResizeIndicator: with YES. - Ken Thomases

2 Answers

0
votes

I came across this, the fix for me was to subclass NSWindow and put this in the implementation:

- (BOOL)canBecomeKeyWindow
{
    return YES;
}
0
votes

NSWindow.styleMask indicating what kinds of control items it displays should include NSResizableWindowMask that tells to display a resize control.

[window setStyleMask:NSResizableWindowMask];