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
-1
votes
1 answer

Can't take focus off NSTextField and select other NSTextFields

I am having a bit of a problem with the UI/data entry part of my macOS application. In my application I have 6 NSTextFields, 1 NSDatePicker and 1 NSPopupButton. After typing in one NSTextField (specifically the one assigned to an outlet called…
-1
votes
1 answer

Override NSTextField - mouseDown only fires once

In my code I am overriding the mouseDown(with event: NSEvent) however am finding that the mouse down event only fires once, when the NSTextField becomes firstResponder class GSTextField: NSTextField { override func mouseDown(with event: NSEvent)…
Gazing South
  • 115
  • 8
-1
votes
1 answer

How to set NSTextField top-left origin?

Swift 4.1, Xcode 9.3, cocoa App How to set NSTextField top left origin so it will always show up as top left regardless of how people zoom in the view? @IBOutlet weak var inputFromTextField: NSTextField! @IBAction func buttonMain(_ sender:…
-1
votes
1 answer

How to add item into NSOutlineView in the edit mode?

I am working with NSOutlineView, and everything works well, I can enter edit mode when clicking on the table cell. However, I want to enter the edit mode automatically when a new row is inserted. I played around with makeFirstResponder method, but…
-1
votes
1 answer

Restore the visual state of an NSAttributedString after having clicked on it

I need to restore the visual state of an NSAttributedString after having clicked on it. My NSAttributedString contains links attributed to ranges. In this example the text "@user" has a a link to "htpp://somesite.com/": let text = "Hey @user!" let…
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
-1
votes
1 answer

Save text field data with Swift 2

How can I save text field content with Swift 2.0? I try to use this: @IBOutlet weak var MyTextField: UITextField! @IBOutlet weak var MyLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() let stringKey =…
Michele De Nardi
  • 636
  • 8
  • 31
-1
votes
1 answer

why setStringValue call works in viewDidLoad and viewDidAppear but not in other methods?

I am trying to change the value of the label here. Can anyone explain me why the following method call: [_detailLabel setStringValue:@"this is new label value"]; works if I make the call from viewDidLoad and viewDidAppear methods, but it doesn't…
user2417624
  • 653
  • 10
  • 32
-1
votes
2 answers

Modify stringValue of NSTextField in Swift

I am trying to change the content of NSTextField in the ViewController by changing its stringValue coming from AppDelegate, but it gives me an error. The code in AppDelegate is: class AppDelegate: NSObject, NSApplicationDelegate { var…
Jack44
  • 17
  • 6
-1
votes
2 answers

How to I set the text in a textField?

I have a text field, and I made a reset button for my app. I want the reset button to set the text of the text field to @"", or empty string. Which function do I use? PS I created the IBOutlet, and the textfield is called textFieldX.
XtremeHek3r
  • 381
  • 2
  • 16
-1
votes
1 answer

NSTableView.reloadData() for NSTextFields

I'm working on a little mac application on swift, and I have not been swifting for very long, but am aware of the function reloadData() for NSTableViews. In my program, I incorporate the function controlTextDidChange for an NSTextField. I would like…
GregarityNow
  • 707
  • 1
  • 11
  • 25
-1
votes
1 answer

Trouble with NSTextField in Swift using xcode 6.1 (OSX)

I started Swift but not Objective C. Can someone teach me how to get and set the NSTextField in Swift using xcode 6.1 under OSX?
ikibiki
  • 136
  • 2
  • 10
-1
votes
1 answer

Getting NSTextField Value from another Class

I have a class called TextFieldMagic which handles the NSTextField manipulations, animation,validation etc. I want to get the NSTextField instance from tne TextFieldMagic class in my AppDelegate. I tried the following and I couldnt get it working.…
Silican
  • 124
  • 1
  • 12
-1
votes
2 answers

Trying to convert NSTextField to string with NSDate

-(void)updateString { NSString * timeStampString = @"1316641549"; NSTimeInterval _interval=[timeStampString doubleValue]; NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval]; NSLog(@"%@", date); …
Grant Wilkinson
  • 1,088
  • 1
  • 13
  • 38
-1
votes
1 answer

IBOutlet undeclared

I'm writing a Mac application, and I have a text field whose contents I would like to update. In the Interface Builder I control-dragged my text field into AppDelegate.h, which created the line @property (unsafe_unretained) IBOutlet NSTextField…
Nick
  • 6,900
  • 5
  • 45
  • 66
-2
votes
2 answers

How to focus on a text field when opening an application?

How to focus on a text field when opening an application? Swift 4, Xcode 10, macOS ANSWER: Thanks to the advice by @Willeke in the comments, I did it this way: import Cocoa import AppKit import Foundation let defaults =…
Marina
  • 44
  • 6
1 2 3
68
69