Closing window with "red button"?

  • Hi!
    A second question regarding how things are implemented.
    If I close my main window with "red button" (upper left corner), how
    is that action implemented?
    Asigned in the main menu I have a button for showing the window again.
    I have tried makeKeyAndOrderFront: but that just make my app crash.

    Many thanks!

    Marcus
  • On 31 okt 2006, at 21.48, Marcus Pedersén wrote:

    > If I close my main window with "red button" (upper left corner),
    > how is that action implemented?

    It calls the "-[NSWindow performClose:]" action method.

    > Asigned in the main menu I have a button for showing the window again.
    > I have tried makeKeyAndOrderFront: but that just make my app crash.

    Is the window configured to "release when closed"? Check the
    inspector in Interface Builder.

    j o a r
  • > A second question regarding how things are implemented.

    You really ought to look at some of the documentation before asking
    questions like these.  It's really very comprehensive:

    <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Cla
    sses/NSWindow_Class/index.html
    >

    > If I close my main window with "red button" (upper left corner), how
    > is that action implemented?

    [window close];

    > Asigned in the main menu I have a button for showing the window again.
    > I have tried makeKeyAndOrderFront: but that just make my app crash.

    If your window is set up with 'release on close' checked, it gets
    freed when it is closed.  Your app will crash when trying to send a
    message to that released window (or it might not crash, but it won't
    work, anyway).

    Stephen Deken
    <stephen.deken...>
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today