title: How do I make a window the active window in a Cocoa multi window app?
body: <p>I have a multi window Cocoa app, implemented using the techniques described in an answer to a previous <a href="https://stackoverflow.com/questions/7688137/what-is-the-best-approach-for-a-multi-window-document-based-cocoa-app">question</a>.</p>
  
  <p>All works fine, however windows opened after the initial window come up and are shown front, but their state is not active (everything greyed). I have to explicitly click inside their frame to make them the active window.</p>
  
  <p>My checks so far:</p>
  
  <ul>
  <li>I've tried <code>makeKeyAndOrderFront:</code> but that doesn't make any difference.</li>
  <li>The file owner in the NIB is set to the corresponding controller class of the window.</li>
  <li>I can see in the Debugger that the instance of each controller is actually the owner of the corresponding window.</li>
  <li>The solution suggested by NSThread does not make the the window key window.</li>
  <li>The method <code>canBecomeKeyWindow</code> returns <code>NO</code> although the window is an instance of NSWindow.</li>
  <li>The window has a title bar and is resizable.</li>
  </ul>
  
  <p>What do I need to do to show subsequent windows in an active state?</p>
  
  <p>EDIT:</p>
  
  <p>I subclassed <code>NSWindow</code> with <code>SecondaryWindow</code> and override <code>canBecomeKeyWindow</code> to return <code>YES</code>. I changed to XIB to use the newly created subclass of <code>NSWindow</code>. Stepped through the code with the debugger, but still the window does not become the key window.</p>