nstextfield

Disable Option-Enter line breaks in NSTextField?

I want to disallow entering a new-line character in my NSTextField, which by default is possible by typing Option-Enter (or Option-Return). While I found some pages explaining how to allow line breaks without having to use the Option modifier, I couldn't find anything for disabling line breaks altogether. How can this be done? ...

How to disable drag-n-drop for NSTextField?

I want to disallow dropping anything into my NSTextField. In my app, users can drag and drop iCal events into a different part of the GUI. Now I've had a test user who accidentally dropped the iCal event into the text field – but he didn't realize this because the text is inserted in the lines above the one that I see in my one-line text...

NSTextField with "padding" on the right

I am trying to get the "remaining chars notice" to show up within my rounded NSTextField and I got it with two NSTextFields with help of the Interface Builder and it already looks like that: But when I write a little bit more it looks like that: The only thing I could think of is to subclass NSTextField and do something with it so ...

Which delegate method I should use to respond to clicks on a NSTextField?

I want to open a panel when the user clicks on a text field. I think I should use a delegate method that responds to the click event. I found that the (void)textDidBeginEditing:(NSNotification *)aNotification method does not work, and that the (void)controlTextDidBeginEditing:(NSNotification *)aNotification method works, but only...

Clickable url link in NSTextFieldCell inside NSTableView?

I have a NSAttributedString that I'm using in a NSTextFieldCell. It makes several clickable url links and puts a big NSAttributedString inside the NSTextFieldCell. Whenever I am viewing the NSTextFieldCell normally and it's highlighted, I cannot click on the links. If I set the TableView so I can edit each column or row, when I click tw...

How to limit NSTextField text length and keep it always upper case?

Need to have an NSTextField with a text limit of 4 characters maximum and show always in upper case but can't figure out a good way of achieving that. I've tried to do it through a binding with a validation method but the validation only gets called when the control loses first responder and that's no good. Temporarly I made it work by ...

How to customize NSTextField look (Font used, font size) in Cocoa ?

Hello everybody, I'm making a Cocoa application and I can't figure out how to do something. I want to make an NSTextField with a custom look like the one in Wallet : Wallet screenshot. I figured out how to change the NSTextField size but I don't know how to change the font and it size. I subclassed NSTextFieldCell like this but it ...

Dynamic Results and Covering Data

Hi Everyone: Today I have a question that sprouted off of this one: http://stackoverflow.com/questions/1082840/database-results-in-cocoa. It's regarding using the data that was returned by a database to create a certain number of questions. I am using a form of the following code (this was posted in the question). NSMutableDictionary...

Multiline NSTokenField and the return key

Hi, I have a NSTokenField object with multilines (just resized the control vertically in interface builder). Unfortunately the NSTokenField object does not insert new line when pressing the return key. Any ideas how to make the control insterting a new line when pressing the return key? Do I really have to go the complicated way throu...

How can I resize an NSTextField to fit the text that it holds?

I'm using an NSTextField to display lines of text that will be printed on a printer with a variable paper size (the printer prints to a spool, which is cut to the appropriate length when the job is done). I can generate the text no problem, but I need to know how big to make the NSTextField (vertically) so that it exactly contains all o...

Is there a way to use bindings with an editable NSSecureTextFieldCell in an NSTableView?

I have an NSTableView with several columns, one of which is set up to use an NSSecureTextFieldCell as its dataCell. I am using a properly configured NSArrayController to provide data to this table. The problem is that my secure text field does not want to work. It shows an appropriate number of dots for the strings that it holds, but it...

Outer Glow for UIView

Hi Everyone: I am wondering how I can create an outer glow effect outside a UIView on the iPhone, kind of like when clicking a regular NSTextField on the Mac. Thanks for any help! ...

NSTextField on top of custom drawing - black outline and cursor not blinking?

Hey All, I'm completely stumped with this problem. I made a custom search control that uses a few different classes. For some reason, when an NSTextField is anywhere over these different pieces, it displays a solid black border around it, and the cursor doesn't blink. If anyone has a couple minutes - I've put together my code on pasteb...

NSTextField set maximum characters

Is there an easy way for me to set a limit on the amount of characters my NSTextField can have? I don't want to have a counter then warn the user if it's over the limit, I want to set the limit so if it's past x characters that's it, they can't type anymore. ...

Two Digit Years with NSDateFormatter not working

I have a 10.4 style date formatter applied to an NSTextFieldCell. I call setTwoDigitStartDate: (tried with both the epoch date and the "reference" date) but when I type in a date with a two digit year it sets the year to 0009 instead of 2009. Header: IBOutlet NSTextFieldCell *transactionDateField; // outlet *IS* set correctly in IB I...

How to control the text color of an NSTextField when it is displaying a placeholder marker?

When the NSTextField (Label) is bound to a controller selection with bindings, and I have specified placeholder values for the Multiple Values Marker, No Selection Marker, etc it draws the text with a gray color that does not show up well on a dark background. Is there a way to change the text color it uses to display the placeholder te...

Add shadow (recessed text effect) to Cocoa label without degrading text rendering quality

I'd like to create statusbar with text effect like in Safari or iTunes, i.e. recessed text. However, if I simply add shadow in Interface Builder using Core Animation panel, OS X's worst text rendering kicks in: What's the trick to get recessed text on a label and keep proper subpixel rendering? ...

Assigning variable values to NSTextFields in Objective-C

I'm a complete newbie to Objective-C, coming from a background of PHP, assorted dialects of BASIC, and a smattering of C/C++. While I feel I've got a fair handle on setting basic windows up in Interface Builder, however, I'm having trouble manipulating the content of text fields, especially calling values from them and sending values to...

Drawing in NStextField

Hey ho! If you wanted to implement a highlighting for specific substrings in a NSTextField like on the screenshot (Tweetie.app) how would you do it? :) Thanks for your help! ...

How do I get NSTextFields to fully animation using Core Animation with a layer backs NSView

I have a very basic app I'm using for experimenting with Core Animation. NSWindow -ContentView --CustomView ---NSTextField I set the content view to be layer backed in interface builder and create a transform.rotation animation. When I add this to the content view it rotates properly, but the NSTextField also remains painted at the or...