NSControl is an abstract superclass that provides three fundamental features for implementing user interface devices: drawing devices on the screen, responding to user events, and sending action messages. It works closely with the NSCell class.
Questions tagged [nscontrol]
60 questions
2
votes
1 answer
NSControl isEnabled only available in OS X v10.0 through OS X v10.9
Does anybody know why NSControl's isEnabled has been removed while setEnabled: is still working?
user1360618
2
votes
1 answer
NSCollectionView stealing focus when selectable=YES
I have an NSView created in Interface Builder with two controls in it, an NSCollectionView and an NSTableView. When my app runs and attaches this view to the window, the focus will correctly be set on my table view and highlight the appropriate row.…

seanalltogether
- 3,542
- 3
- 26
- 24
2
votes
1 answer
Let NSSlider move in other ways?
I am trying to figure out how to make a slide action without dragging.
Usually when I want to change values using slider, I do either "leftClick anywhere on the slider field" or, continuously "leftClick the knob and drag it".
What I would like to…

user2549858
- 21
- 2
2
votes
1 answer
What method should I call on my NSCell
I am writing a custom NSControl with custom NSCells. It is a control, so it has to respond to the mouse. I created an NSTrackingArea over my control, implemented -mouseEntered:, -mouseExited: and -mouseMoved:. (And I will have to implement…

11684
- 7,356
- 12
- 48
- 71
2
votes
2 answers
Is there a custom control similar to NSLevelIndicator with reverse coloring?
I need a control similar to NSLevelIndicator in NSContinuousCapacityLevelIndicatorStyle, but with reverse coloring. With NSLevelIndicator, the colors are like this:
Green up to the warning level, yellow from warning to critical level, red from…

Dirk
- 2,335
- 24
- 36
2
votes
0 answers
keeping NSPanel controls active
I have an NIB-based NSPanel, style Utility Panel, that I'm making a child window of my NSDocument window. I'd like it to behave like a drawer, in that it appears like part of the window, with controls drawn in their active-window state whenever the…

Pierre Houston
- 1,631
- 20
- 33
2
votes
1 answer
Custom Cocoa Control, what exactly is this?
There are several applications that use this control. One I think most everyone knows is Xcode, another is AppStar. I am interested to know what control this is and where I can find an open source implementation of it:
"The box thingy within the…

WrightsCS
- 50,551
- 22
- 134
- 186
1
vote
2 answers
How do I define an action for a custom NSControl in code?
I have made a subclass of NSControl which is a combination of a number formatted NSTextField and an NSStepper. Here is the basic code:
class StepperWithNumberField: NSControl, NSTextFieldDelegate {
let numberField: NSTextField
let stepper:…

MassMover
- 529
- 2
- 17
1
vote
1 answer
First responder on mouse down behavior NSControl and NSView
I have a custom control. If it inherits from NSView, it automatically becomes the first responder when I click on it. If it inherits from NSControl, it does not. This difference in behavior persists, even if I override mouseDown(with:) and don't…

mistercake
- 692
- 5
- 14
1
vote
1 answer
How to use NSControl's edit(withFrame:editor:delegate:event:)?
I have a custom NSControl and I'm trying to get the function edit(withFrame:editor:delegate:event:) to work. Upon calling it I expect the field editor to show up in my view, but nothing happens.
I have read through the documentation for for the…

mistercake
- 692
- 5
- 14
1
vote
2 answers
Where is NSControl's addTarget() method?
So I haven't looked at Swift/Cocoa in several years. I just created a simple macOS app using Xcode 10.0 and see that NSControl no longer has an addTarget(...) method. It looks like it was replaced by a target property of type id.
How do I go about…

RobertJoseph
- 7,968
- 12
- 68
- 113
1
vote
1 answer
NSImageView, copy image with CMD/CTR+C
If a NSImageView is Editable and contains an image, it is possible to copy it's content via CMD+C
In my subclass i don't want the Editable property to be YES (cause of cut, drop, etc...) i just want to support the copy, but wasn't able to figure…

Peter Lapisu
- 19,915
- 16
- 123
- 179
1
vote
0 answers
Multiple NSbutton tracking hover while mouse down
I want to create a similar row of buttons like in Xcodes Utilities side panel (see image).
I'ts easy to just add four Image buttons beside each other. But, there's one feature that I haven't solved yet.
If you press and hold on one of the buttons,…

Erik Berglund
- 53
- 8
1
vote
0 answers
Window moves when clicking control in title region with titlebarAppearsTransparent
I have a window that uses the Yosemite titlebarAppearsTransparent and titleVisibility = NSWindowTitleHidden properties to extend the content under the title region. It is also movableByWindowBackground.
This works fine, however if I have a control,…

Dejal
- 813
- 6
- 18
1
vote
0 answers
Custom NSControl
I'm trying to create my own NSControl by creating xib file and associate it with its .h and .m files
My control is a subclass of NSControl and it contains NSStepper and NSTextfield, the reason I use the NSControl superclass is that I want my control…

Mark S
- 235
- 3
- 11