Implementing applicationShouldTerminateWhenLa

  • mox

    mox - 2007-02-11

    I want my application to terminate when my "last" window is closed.

    Actually it's a one window application and I don't want it to work in "Document mode" like every applications.

    I'm currently working on a SSH Front End (similar to Putty / SecureCRT) for OS X

    Here is a screenshot of a pre-beta

    Once I finish the "Connections" window and that everything works I will put it on

    If anyone wants to see the source or wants to help me I can be contacted on msn or email at


    • mox

      mox - 2007-02-11

      Ok.. looks like I found the answer by myself.. after ~3-4 days of searching.. lol

      1) Open the .pm with your project name.. (, not
      2) add "applicationShouldTerminateAfterLastWindowClosed" in the properties of your ProjectName class
      3) create the following sub:
      sub applicationShouldTerminateAfterLastWindowClosed : Selector(applicationShouldTerminateAfterLastWindowClosed:) ArgTypes(@) ReturnTypes(v) {
        my ($self) = @_;

      Et voila ! :)

    • Sherm Pendley

      Sherm Pendley - 2007-03-12

      Ouch. No, that is *not* what this delegate method is for. Like all delegate methods with names like fooShouldBar, the idea here is to give the delegate "veto power" to either allow Bar to proceed, or not. The correct return value (as is clearly stated in the Cocoa docs...) is a BOOL (c), not void (v).

      You return TRUE (i.e. 1 from Perl) if the app should be allowed to terminate, and 0 if not.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks