Questions tagged [nstextfield]

NSTextField object belongs to Apple's class. It's a kind of NSControl that displays text that the user can edit or select.

An NSTextField object is a kind of NSControl () that displays text that the user can select or edit and that sends its action message to its target when the user presses the Return key while editing.

The NSTextField () class uses the NSTextFieldCell () class to implement its user interface.

References:

1028 questions
0
votes
2 answers

How to change NSTextField value from another NSView (different swift files)

I have two different NSViews. viewA is controlled from ViewA.swift viewB is controlled from ViewB.swift I want to change textField (NSTextField) that is in viewB from viewA. i change it by creating an instance of viewB from viewA, but i get an…
DanielZanchi
  • 2,708
  • 1
  • 25
  • 37
0
votes
1 answer

Validate decimal max/min values in a NSTextField

First of all i have to do this without IB and without advanced Objective-C techniques like KVO. My problem comes from the simple fact that i can't find a way to get the whole new string value of the text field. I'm tried using the delegate…
Lothar
  • 12,537
  • 6
  • 72
  • 121
0
votes
1 answer

Force cocoa binding to update after validating (swift)

I check for and remove spaces from a NSTextField in controlTextDidEndEditing, but these changes are not reflected in the cocoa bindings (the CoreData entry is not updated). The NSTextField is updated, but if you click out of the entry and go back in…
glenstorey
  • 5,134
  • 5
  • 39
  • 71
0
votes
2 answers

Bind properties in Swift to NSTextFields

I'm working on a unit converter written in Swift that will automatically display the updated units within the appropriate NSTextFields. For this example, if the user inputs minutes into the minutesField, the secondsField and hoursField should…
wigging
  • 8,492
  • 12
  • 75
  • 117
0
votes
1 answer

How to replace programmatically "No Selection" placeholder in NSTextField that uses binding?

My app has one NSTableView on the left (master) and text fields on the right (details) I use core data & binding to get the records displayed. I have a text file that is bind with NSObjectController. It is a date field, and I have added…
user2417624
  • 653
  • 10
  • 32
0
votes
1 answer

NSTextFieldCell's cellSizeForBounds: doesn't match wrapping behavior?

It seems to be commonly accepted that cellSizeForBounds: allows one to calculate a text field's "natural" size. However, for NSTextField, I've found that it doesn't quite match: @interface MyTextField : NSTextField @end @implementation…
jtbandes
  • 115,675
  • 35
  • 233
  • 266
0
votes
1 answer

NSTextField string with newlines

I have a series of objects with an optional "comment" field, which contains a string. I'd like to extract all the comments and list them as separate lines in an NSTextField (or any other suitable view). So I did this... @IBOutlet var…
Maury Markowitz
  • 9,082
  • 11
  • 46
  • 98
0
votes
1 answer

What is the system color of a NSTextField's text?

I manipulate the text color of a NSTextField. Due to the fact that these cells could be reused, I have to reset the color to the default one in my tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row:…
Tobonaut
  • 2,245
  • 2
  • 26
  • 39
0
votes
1 answer

Enforcing Max Length in a NSTextField with binding to CoreData String

A NSTextField is bound to a Core Data entity string object. In the core data model the string has a max length of n characters. Is there an elegant way to enforce this same limit on the NSTextField using bindings, or is the only way to…
glenstorey
  • 5,134
  • 5
  • 39
  • 71
0
votes
2 answers

How to create a custom NSTextField with text entry option

I am trying to figure out how to do a custom NSTextField like the ones on the screenshot. Can anyone point me to a guide or in the right direction at least? I mean i understand that you can drawn the background and the box, but how do you tell the…
Dmitri K.
  • 197
  • 1
  • 13
0
votes
2 answers

Force NSSearchField to Begin Editing When It Becomes First Responder

I have an NSSearchField in an NSPopover. This popover is opened when an NSStatusBar item is clicked. In my NSPopover's view controller's viewWillAppear(), I call self.view.window?.makeFirstResponder(searchField) on my NSSearchField. I want…
elliottbolzan
  • 1,057
  • 1
  • 15
  • 30
0
votes
3 answers

How to use DidEndEditing on textfield on OS X (swift)

The thing I want to implement here is after I press the return key, if text of the textfield is match the word January, print right, if not, print wrong. But when I pressed the return key, Nothing is printed. Can anyone write a sample code about how…
0
votes
1 answer

NSTextField should appear when another NSTextField gets focus

I have a NSTextField which I subclassed from NSTextField and I want that a new NSTextField appears when my TextField gets focus. I changed the method becomeFirstResponder , which also works, cause it prints "TextField got focus" in the log area. But…
Robby
  • 23
  • 8
0
votes
2 answers

Custom NSLevelIndicator doesn't show assigned values

I have created a custom NSLevelIndicator which can display a string value within it. Below is the code for it. I tested this in a storyboard OSX app and it works well. import Cocoa class CustomLevelIndicator: NSLevelIndicator { var text:…
Isuru
  • 30,617
  • 60
  • 187
  • 303
0
votes
1 answer

NSTextField binding causes EXC_BAD_ACCESS

I have an NSTextField which is bound to an int in an object that I have included in my nib. When the object changes its int, the text field follows suit, and everything looks fine. However, when I try to change it manually the program crashes as…
Brian Postow
  • 11,709
  • 17
  • 81
  • 125