Reputation: 26875
I have a semi-transparent NSView
subclass that acts as a kind of tooltip. When the tooltip is drawn on the screen it draws on top of a form and so it covers a couple of NSTextField
's.
When I hover the mouse over the tooltip at the spots where a NSTextField exists, the cursor changes to the input style cursor.
How can I prevent the cursor from changing?
Upvotes: 0
Views: 644
Reputation: 46028
Overlapping views are not really supported very well in Cocoa and the behaviour is undefined.
Instead, your tooltip view should be in its own borderless window, large enough to contain your view. The tooltip window should be a child window of the main window it's attached to. To make a window a child of another window, you use the addChildWindow:ordered:
method of NSWindow
.
Child windows are attached to the parent window and will move with their parent window when the parent window moves. If you just open a new window without making it a child window, it will be "left behind" if the other window is moved.
To make a borderless window, pass NSBorderlessWindowMask
as the styleMask
to the initWithContentRect:styleMask:backing:defer:
method of NSWindow
.
Upvotes: 1