Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Cocoa Views and Controls Will Create Something like Part of the Network Prefs Display (Mac OS)? [duplicate]

I'm building an OSX app and want to create a set of controls similar to what's found at bottom of the standard Network Preferences configuration panel. I'm running into some layout problems that I wouldn't have expected.

enter image description here

These are my specific questions:

  1. What contains the 3 buttons so there's similar shading all they way across the row where the buttons are positioned? In particular, what's causing the area without buttons to have shading?
  2. How do you do this without getting a double border where the row of buttons meets up with the table?

I want to do this with an xib file. This may be incredibly simple, but I'm missing something I guess.

like image 278
Fitter Man Avatar asked Sep 29 '22 04:09

Fitter Man


1 Answers

I find that if you make a button with style "Gradient" and type "Momentary Change", then it looks like the other buttons but does not respond to clicks, so you can use that as the area after the last button. (The NSMomentaryChangeButton is documented as changing the image and title when clicked, so if you don't use an image or title, nothing should change.)

If you check Refuses First Responder in the attributes inspector, then it will not be possible to highlight this blank button using Full Keyboard Access.

Ken Thomases also brings up the issue of the blank button being shown as a button to Accessibility. One can fix that by using a subclass of NSButtonCell that has just one method:

- (BOOL)accessibilityIsIgnored
{
    return YES;
}

I think that's easier than writing a custom view.

As d00dle says, avoid double borders by slightly overlapping things.

like image 126
JWWalker Avatar answered Nov 15 '22 06:11

JWWalker