Re: [Q] Hiding zoom & minimize buttons
Re: [Q] Hiding zoom & minimize buttons
- Subject: Re: [Q] Hiding zoom & minimize buttons
- From: Gordon Apple <email@hidden>
- Date: Wed, 22 Oct 2008 12:58:06 -0500
- Thread-topic: [Q] Hiding zoom & minimize buttons
Here is what I do in the window controller or in the code that loads the
window:
- (void)windowDidLoad
{
// Hiding the disabled window buttons (removing them is deadly --
don't do it!)
[[[self window] standardWindowButton:NSWindowMiniaturizeButton]
setFrame:NSZeroRect];
[[[self window] standardWindowButton:NSWindowZoomButton]
setFrame:NSZeroRect];
}
On 10/22/08 12:36 PM, "email@hidden"
<email@hidden> wrote:
> Message: 4
> Date: Wed, 22 Oct 2008 11:13:32 -0400
> From: Eric Gorr <email@hidden>
> Subject: Re: [Q] Hiding zoom & minimize buttons
> To: Cocoa Developers <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
> On Oct 22, 2008, at 10:53 AM, Michael Ash wrote:
>
>> On Wed, Oct 22, 2008 at 10:36 AM, Eric Gorr <email@hidden>
>> wrote:
>>> I found this old thread:
>>>
>>> http://lists.apple.com/archives/cocoa-dev/2006/Mar/msg01864.html
>>>
>>> and I would like to know the same thing. Unfortunately, the old
>>> thread did
>>> not conclude with an answer.
>>>
>>> While it is possible to obtain the button by doing:
>>>
>>> NSButton *miniaturizeButton = [myWindow
>>> standardWindowButton:NSWindowMiniaturizeButton];
>>> [miniaturizeButton removeFromSuperview];
>>>
>>> this results in a crash.
>>
>> First, I highly recommend against doing this. If Cocoa keeps them
>> present but disabled then you ought to stick with that
>
> As was mentioned in the old thread, according to the HI Guildlines, it
> is perfectly acceptable to not have those buttons. Furthermore, it is
> quite common in several applications for a window to not have a
> miniaturize or zoom button...particularly NSPanels (they are Windows).
>
> But, in any case, minutes after I posted this, I found an answer:
>
> NSButton *miniaturizeButton = [myWindow
> standardWindowButton:NSWindowMiniaturizeButton];
> [miniaturizeButton setHidden:YES];
>
> while it doesn't appear that one can create a window without these
> buttons, it is trivial to hide them.
>
> If there is a better solution, I would be interested.
>
G. Apple
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden