nstextfield

Data Detectors in Cocoa

陌路散爱 提交于 2019-12-30 11:16:32
问题 I want to add a data detector in an NSTextField / NSTextView like in Mail (e.g. date, email, URL, etc). Does anyone have an idea how to do this ? I think I saw it in TextEdit's source code but when I checked it was 2005's version and I can't find the new source code. Alex 回答1: You need to set the formatter outlet of the object. Built in formatters are NSDateFormatter and NSNumberFormatter. You can define custom formatters by extending the NSFormatter class. There is a chapter in Aaron

Invalid color System, labelColor (warning given only once)

跟風遠走 提交于 2019-12-30 08:12:11
问题 I am getting following warning on OS X 10.9 console at the time of nib load( NSWindowController ). Invalid color System, labelColor (warning given only once) I am using Xcode 6 and OS X 10.10 to compile my code. Most probably this warning is coming because of NSColor exposes new system colors in 10.10 for static text and related elements: labelColor, secondaryLabelColor, tertiaryLabelColor, and quaternaryLabelColor. How to fix this warning? 回答1: Change your textfield's color in your xib file

Invalid color System, labelColor (warning given only once)

拥有回忆 提交于 2019-12-30 08:11:05
问题 I am getting following warning on OS X 10.9 console at the time of nib load( NSWindowController ). Invalid color System, labelColor (warning given only once) I am using Xcode 6 and OS X 10.10 to compile my code. Most probably this warning is coming because of NSColor exposes new system colors in 10.10 for static text and related elements: labelColor, secondaryLabelColor, tertiaryLabelColor, and quaternaryLabelColor. How to fix this warning? 回答1: Change your textfield's color in your xib file

NSWindow textured background with NStextField

北城以北 提交于 2019-12-30 02:36:05
问题 I have a super strange problem. I want a Textured window to have it normal gradient color. I have an NSTextField in this window, the text field is destined to be an URL input field so it need to be large. The problem is that when it is too large (approximately more than 1/3 of the window width) it just switch the textured window to draw a darker version of it gradient. Here is an example project (very simple...) for you to test. http://raven.ipodtutofast.com/test.zip When you will build and

NSTextField transparent background

安稳与你 提交于 2019-12-29 11:45:15
问题 I create transparent NSTextField self.myTextField = [[NSTextField alloc] initWithFrame:CGRectMake(backgroundView.frame.origin.x + backgroundView.frame.size.width + 20, self.projectTitle.frame.origin.y - 30.0, 100, 20)]; self.myTextField.editable = NO; self.myTextField.bezeled = NO; self.myTextField.drawsBackground = YES; self.myTextField.backgroundColor = [NSColor clearColor]; self.myTextField.selectable = NO; self.myTextField.font = [NSFont fontWithName:@"Helvetica Neue" size:16]; [self

NSTextField, Change text in Swift

陌路散爱 提交于 2019-12-29 03:21:59
问题 I can't seem to be able to change the text Label in a Mac app that I am trying to make. I am using swift. Here is the code I am using: @IBOutlet var sumlab: NSTextField! sumlab.text = "\(result.sum)" // result.sum is the result of a function I made // I also tried this: sumlab.text("\(result.sum)") // and this: sumlab.insertText("\(result.sum)") None of these seem to work and this is the only problem I need to solve to finish my program. P.S. when i write sumlab.text it says NSTextField does

NSTextField, Change text in Swift

为君一笑 提交于 2019-12-29 03:21:06
问题 I can't seem to be able to change the text Label in a Mac app that I am trying to make. I am using swift. Here is the code I am using: @IBOutlet var sumlab: NSTextField! sumlab.text = "\(result.sum)" // result.sum is the result of a function I made // I also tried this: sumlab.text("\(result.sum)") // and this: sumlab.insertText("\(result.sum)") None of these seem to work and this is the only problem I need to solve to finish my program. P.S. when i write sumlab.text it says NSTextField does

NSTextField GotFocus Event Cocoa Swift

狂风中的少年 提交于 2019-12-25 09:48:49
问题 In swift Cocoa is there an event that fires when a NSTextField gets focus for editing. I Come from C# which has GotFocus() and LostFocus() Events. For NSTextfield I could find only these functions which fire after one starts typing. Not as soon as focus is gained. override func controlTextDidBeginEditing(obj: NSNotification) { } func control(control: NSControl, textShouldBeginEditing fieldEditor: NSText) -> Bool { } I Need this because as soon as someone starts editing, I want to show more

NSTextField GotFocus Event Cocoa Swift

做~自己de王妃 提交于 2019-12-25 09:47:38
问题 In swift Cocoa is there an event that fires when a NSTextField gets focus for editing. I Come from C# which has GotFocus() and LostFocus() Events. For NSTextfield I could find only these functions which fire after one starts typing. Not as soon as focus is gained. override func controlTextDidBeginEditing(obj: NSNotification) { } func control(control: NSControl, textShouldBeginEditing fieldEditor: NSText) -> Bool { } I Need this because as soon as someone starts editing, I want to show more

ControlTextDidChange not working for setting string of NSTextField

强颜欢笑 提交于 2019-12-25 08:58:12
问题 I'm trying to find a method that monitors the text of NSTextField for changes. I tried the delegate method of -(void)controlTextDidChange:(NSNotification *)obj but it only works when the user types into the text field. If the text field string is programmatically set, such as with a button, the controlTextDidChange doesn't work. Is there a method or another approach that I can use to monitor the contents of a NSTextField for changes? My ButtonText class (set as delegate for the NSTextField):