How to: show mainWindow on Activate

This is useful for utility apps and allows the user to close the main window and have it reopened when the app is re-activated.

   -- activates the main window clicking when on dock icon (if it is not already visible) 
    on applicationShouldHandleReopen_hasVisibleWindows_(self,visible)
      if visible then
            return true
            else
            -- mainWindow is an outlet that's linked to the main Window in IB
            mainWindow's makeKeyAndOrderFront_(self)
            return false
        end
    end

Save mainWindow Size and Position:


-- mainWindow is an outlet that's linked to the main Window in IB
-- add this to your startup handler (awakeOnNib or app did finish launching)
(mainWindow's windowController)'s setShouldCascadeWindows_(false)
        mainWindow's setFrameAutosaveName_("mainSizePos")