Setting a Box’s Border Appearance

The appearance of an NSBox is set using a combination of the methods setBoxType: and setBorderType:. By default an NSBox instance is set to use the NSBoxPrimary box type and the NSGrooveBorder border type.

The appearance in Figure 1 is achieved by calling the method setBorderType: and specifying NSNoBorder as the box type.

Figure 1  NSBox with no visible border
NSBox with no visible border

The appearance in Figure 2 is achieved by calling the method setBorderType: and specifying NSGrooveBorder as the border type, and calling setBoxType: and specifying NSBoxPrimary as the box type.

Figure 2  NSBox displaying primary appearance
NSBox displaying primary appearance

The appearance in Figure 3 is achieved by calling the method setBorderType: and specifying NSGrooveBorder as the border type, and calling setBoxType: and specifying NSBoxSecondary as the box type.

Figure 3  NSBox displaying secondary appearance
NSBox displaying secondary appearance

Note that the border appears inside the box and can reduce the amount of space available to the content rectangle.


Did this document help you? Yes It's good, but... Not helpful...