The NSBox class implements simple views that can title themselves and draw a border around their content. These objects are known as boxes. You can use box to group, visually, some number of other views.
Questions tagged [nsbox]
39 questions
8
votes
1 answer
How to draw focus ring around NSBox on focus of child NSTextView in objective-c
I have one NSTextView within NSBox. I want to draw focus ring aroung NSBox whenever NSTextView got focus and remove focus ring as soon as NSTextView lost focus.
Thanks,

AmitSri
- 1,209
- 1
- 20
- 48
6
votes
1 answer
NSImageView Drag and Drop issues
I have an NSBox containing two static text fields and two NSImageView.
NSBox is subclassed as myNSBox.
I have registered the view/NSBox to accept appropriate drag types.
So when i drag items to the static text fields, the drag-drop…

user598789
- 329
- 1
- 2
- 17
3
votes
2 answers
Is it possible to make a NSBox clickable (like a NSButton) in Swift macOS?
I have a NSBox with some labels inside it, that I want to act as a button. Is this possible, or do I have to find some other way to make large areas of an application clickable?

frankwolffnl
- 129
- 1
- 8
2
votes
1 answer
Create NSBox runtime example
Please, could you give me examples of how to create the NSBox instance runtime to place it inside the NSView?
user663896
2
votes
1 answer
How do I change the colour of the NSBox Title in swift for macOS OS X?
I am trying to get the window to appear with a black transparent feeling, by setting the window to alpha 0.9, and black. That is not the issue though. My issue is that I have NSBoxes in this window, and by changing the background to black, I cannot…

Hussein Esmail
- 353
- 5
- 21
2
votes
0 answers
Aligning objects that are embedded in a NSBox
I'm trying to align different objects (labels, textfields, ...) to one another within a NSBox. I can align them relative to the NSBox, but not e.g. two labels horizontally or properly spaced.
Is there a setting or anything else I can do? Kind of…

Daniel
- 436
- 3
- 14
2
votes
2 answers
Setting Horizontal Line (NSBox) line width in Interface Builder
I have an application that I am building am making use of Horizontal Line (which is just a special case of NSBox). I've placed the component into the interface, but what to adjust the thickness of the line.
NSBox has a setBorderWidth method, but…

MarkPowell
- 16,482
- 7
- 61
- 77
2
votes
3 answers
Drawing Line Separator with Cocoa
How would one draw a line separator such as this:
Note that there's 2 single pixel lines on top of each other. Any tips?
Edit:
Here's the code I needed, in a NSBox subclass: (or NSView, doesn't really matter):
- (void)drawRect:(NSRect)rect
{
…
user429620
2
votes
2 answers
Selected Menu Item Color not aligned?
I thinks a image is better than a thousand words.
What you see in this picture are NSBox Subclass in a NSViewCollection. I set the fill color to "Selected Menu Item Color" is Interface builder.
Why is the color like that ?
Edit : After reading…

Matthieu Riegler
- 31,918
- 20
- 95
- 134
1
vote
1 answer
Auto resizing NSBox
I have NSBox with NSTableView siting inside it. I have disabled the scrolling in the table and trying to auto resize the NSBox to mach the number of entries in NSTableView but don't know how to...any help?

David
- 11
- 1
1
vote
1 answer
Subclassing NSBox
How could I subclass a NSBox to change the width, height , font type and background color of the Box's title?.

Javier Beltrán
- 756
- 5
- 26
1
vote
1 answer
NSBox background color
Is there a system-defined NSColor for the background of an NSBox? Testing shows it to be RGB (226, 226, 226) but there does not seem to be anything like controlBackgroundColor for it to easily switch when in Dark Mode. I am using this color for the…

Trygve
- 1,317
- 10
- 27
1
vote
0 answers
redundant border in NSStackview
Good morning :)
I working with swift 4 for macOS and play the first time with NSStackViews.
I build a litte example:
NStackView
includes three NSBoxes
all boxes have a 1px border (different colors), which i setted via Storyboard.
The "beautiful"…

Trombone0904
- 4,132
- 8
- 51
- 104
1
vote
2 answers
Xcode/Interface Builder is ignoring the Fill Color setting
I added an NSBox to my view, I set the fill color to the color I want:
But the color doesn't show up in Interface Builder and doesn't show up when I run the app. What am I missing?
I've also tried setting it programmatically via
[self.myBox…

Troy
- 21,172
- 20
- 74
- 103
1
vote
1 answer
UI issues with custom NSBox
I have a subclassed NSBox. Inside I have some NSTextfields embedded, which show some strange artifacts in their corners (see image here). This is my subclass code for the NSBox:
- (void)drawRect:(NSRect)rect {
NSBezierPath* rectanglePath =…

Thomas Szabo
- 163
- 7