window did become front most?

Hi

I have a main window with a button on it, when I click the button it activates another window, when that window becomes front most I want it to run some code, what code would I use to detect that, that window has become front most?, I’ve tried Awake from nib, that doesn’t work, I looked at on windowDidBecomeKey_(notif), but wasn’t sure how to implement it, could some one point me in the right direction please?

Hello !

Try this:

on windowDidBecomeKey_(aNotification)
   if aNotification's object is myOtherWindow then --myOtherWindow is a property
   -- your stuff here
      end if
end windowDidBecomeKey_

Regards,