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
0
votes
1 answer
Give a Key equivalent to NSButton dynamically
I want to assign a key equivalent to an NSButton if the control is the first responder.

Javier Beltrán
- 756
- 5
- 26
0
votes
1 answer
Windows vScrollBar Equivalent in Mac OSX
Does anyone know what is the equivalent of the vertical scroll bar from Windows in Mac OSX? I saw there is NSStepper. But I can't seem to change the display of it at run time.
NSStepper *stepperBar = [[[NSStepper alloc] initWithFrame:NSMakeRect(0,…

user523234
- 14,323
- 10
- 62
- 102
0
votes
1 answer
How can I obtain window's NSControl* from custom sheet button?
I have a simple 'test bed' module consisting of an empty NSWindow. The only item on the window is a button labeled 'Toggle Window' and nothing else. It has one method shown below:
-(IBAction)testResize:(NSControl*)sender;
{
NSRect frame =…

Tom
- 45
- 7
0
votes
2 answers
NSTextField Cursor Position
Is there any way of getting the current cursor position in a NSTextField? I only find answers to UITextField which doesn't work for osx:
if let selectedRange = textField.selectedTextRange{
let cursorPosition = textField.offset(from:…

JFS
- 2,992
- 3
- 37
- 48
0
votes
1 answer
Layer-Backed NSControl Still Calls NSCell Drawing Routines
Context:
Apple has "soft-deprecated" NSCell on macOS. I'm trying to reduce the use of it in my custom NSControl subclasses and, instead, use CALayers to handle my drawing. To do this, I make my NSButton subclass layer-backed:
self.wantsLayer =…

Bryan
- 4,628
- 3
- 36
- 62
0
votes
1 answer
NSButton values are 1
I wanted to use an NSButton's integerValue to pass on information in a method and ran into a curious bug: whatever I set a value to - whether integerValue, stringValue, or floatValue, when I read it out, it's 1.
NSButton inherits from NSControl and…

green_knight
- 1,319
- 14
- 26
0
votes
1 answer
How to catch some events on a NSControl in swift
I am writing an application for OSX in Swift and I am looking for a good way to catch events on a NSControl.
Obviously, I searched but the informations I found are often unclear or old.
In my case, I would like to catch several events on a…

Ced
- 93
- 8
0
votes
1 answer
Subclassing NSControl, IBAction is not called in Swift
I've subclassed an NSSlider that behaves differently whether the option key is pressed. In order to do that, I overrode the mouseDown func. It seems to do the job.
The thing is, I've noticed the connected @IBAction in my ViewController is only…

Joshua
- 147
- 1
- 12
0
votes
0 answers
NSPopupButton with color well
Some of the color selection buttons in the Xcode details panels are a NSPopupButton with a color well. It looks something like a segmented control/popup button.
Placing a standard color well and standard popup button next to each other doesn't have…

user965972
- 2,489
- 2
- 23
- 39
0
votes
1 answer
Can't see the list of events/actions during the Ctrl+drag operation in Xcode
I working with NSxxx kind of controls. It is OS X project.
I expect to see the drop-down control "Event" between the fields "Name" and "Type", with the list of the control library events.
Why I can not see it?

Ruben Kazumov
- 3,803
- 2
- 26
- 39
0
votes
0 answers
Controls on NSPopover not responding
The setup is as follows:
Menubar application with one view controller. The view from the view controller is stored in a NSMenuItem
That view controller has one button we'll call 'Settings button'
When you click Settings button a NSPopover is…

user1660675
- 149
- 3
- 10
0
votes
1 answer
Get a highlighted text in objective-c
I'm trying to get the StringValue of any text (Out side my application) that has been selected by the cursor.
I tried checking on NSControl class,but i didn't find anything useful.

user3717717
- 25
- 3
0
votes
1 answer
Unresponsive UI Elements after closing NSWindow
Last week I spent a good amount of time fiddling around with the following problem. I solved it but since I couldn't find an answer here and I want to share my solution for anybody who runs into this.
Problem: My application runs in the background…

Git.Coach
- 3,032
- 2
- 37
- 54
0
votes
1 answer
NSControl does not work on different Mac
I encountered a very strange problem which I can't solve by myself. I have several UI elements embedded in a NSWindow running as NSBorderlessWindowMask. There are 2 NSSlider, 3 NSButton, a NSComboBox and a NSColorWell.
The application builds for…

Git.Coach
- 3,032
- 2
- 37
- 54
-3
votes
1 answer
Hide NSTouchBar button
I'm working on a personal project in swift (for macOS app) and I want to make a NSbutton (Touch Bar button) and hide it.
Is there a possible way to do this?

AsafH
- 89
- 2
- 9