Note that there are some explanatory texts on larger screens.

plurals
  1. POkeeping NSPanel controls active
    primarykey
    data
    text
    <p>I have an NIB-based NSPanel, style Utility Panel, that I'm making a child window of my NSDocument window. I'd like it to behave like a drawer, in that it appears like part of the window, with controls drawn in their active-window state whenever the document window is main. I'm also planning on customizing the frame, close &amp; minimize buttons.</p> <p>The panel has becomesKeyOnlyIfNeeded &amp; excludedFromWindowsMenu set to YES, and its subclassed to return YES from canBecomeKeyWindow.</p> <p>The panel's NIB contains a NSSegmentedControl and a view into which I add a view from another NIB. I'm finding that the segmented control is being drawn in its window-inactive state unless the panel is clicked on to become key.</p> <p><img src="https://i.stack.imgur.com/8jqQ7.png" alt="enter image description here"></p> <p>I tried a trick from OmniGroup's OIInspectorWindow &amp; cocoadev.com's NSWindow page, implementing an _hasActiveControls method that returns YES, but that seemed to have no effect. I then tried then overriding isMainWindow to return YES whenever the parent window is the main window (plus observing the window's state change notification &amp; calling -display). I was hoping that this would fool the control &amp; window frame to draw in the active state. On 10.7 (Lion) it turns out that the control does indeed draw active as I wanted, though the window frame isn't. On 10.8 (Mountian Lion), not even that, the segmented control is still inactive when the window isn't key.</p> <p>I can live with my trick not affecting the window frame &amp; close button, since I plan on customizing those anyway. Does anyone know either a) why my trick doesn't work on 10.8 and how I can get it to work, or b) another way to ensure my panel's control is always active when its parent window is main.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload