FROM : Evan Schoenberg
DATE : Fri Nov 19 22:39:05 2004
You're right, that will crash as soon as the window resizes.
Here's one way to remove them without crashing:
//Remove those buttons we don't want. removeFromSuperview will confuse
the window, so just make them invisible (zero frame).
[[window standardWindowButton:NSWindowMiniaturizeButton]
setFrame:NSZeroRect];
[[window standardWindowButton:NSWindowZoomButton] setFrame:NSZeroRect];
On Nov 19, 2004, at 1:40 AM, Peter Maurer wrote:
>> So this should remove the zoom button from a window:
>>
>> [[window standardWindowButton:NSWindowZoomButton]
>> removeFromSuperview];
>
> I did this once, and as far as I can remember, my app crashed unless I
> retained those buttons before removing them from their superview.
> Thus, I came to the conclusion that the NSWindow still wanted to
> "talk" to its standard buttons from time to time, and that it was very
> unhappy if someone had released them (via removeFromSuperview).
>
> Can anyone confirm?
>
> (Unfortunately, I don't have access to that piece of code right now,
> so there's a certain possibility that my code had other flaws which
> caused the crash.)
>
> Cheers,
>
> Peter.
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/evan.<email_removed>
>
> This email sent to evan.<email_removed>
>
DATE : Fri Nov 19 22:39:05 2004
You're right, that will crash as soon as the window resizes.
Here's one way to remove them without crashing:
//Remove those buttons we don't want. removeFromSuperview will confuse
the window, so just make them invisible (zero frame).
[[window standardWindowButton:NSWindowMiniaturizeButton]
setFrame:NSZeroRect];
[[window standardWindowButton:NSWindowZoomButton] setFrame:NSZeroRect];
On Nov 19, 2004, at 1:40 AM, Peter Maurer wrote:
>> So this should remove the zoom button from a window:
>>
>> [[window standardWindowButton:NSWindowZoomButton]
>> removeFromSuperview];
>
> I did this once, and as far as I can remember, my app crashed unless I
> retained those buttons before removing them from their superview.
> Thus, I came to the conclusion that the NSWindow still wanted to
> "talk" to its standard buttons from time to time, and that it was very
> unhappy if someone had released them (via removeFromSuperview).
>
> Can anyone confirm?
>
> (Unfortunately, I don't have access to that piece of code right now,
> so there's a certain possibility that my code had other flaws which
> caused the crash.)
>
> Cheers,
>
> Peter.
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/evan.<email_removed>
>
> This email sent to evan.<email_removed>
>
| Related mails | Author | Date |
|---|---|---|
| Ken Tabb | Nov 18, 17:50 | |
| Ricky Sharp | Nov 18, 19:17 | |
| Andreas Mayer | Nov 18, 20:20 | |
| Peter Maurer | Nov 19, 08:40 | |
| Ken Tabb | Nov 19, 12:05 | |
| Ryan Stevens | Nov 19, 17:38 | |
| Evan Schoenberg | Nov 19, 22:39 | |
| M. Uli Kusterer | Nov 22, 08:53 | |
| Ryan Stevens | Nov 22, 15:33 | |
| M. Uli Kusterer | Nov 23, 22:36 |






Cocoa mail archive

