nstextfield

getting values from NSTextField in objective c and xcode

How can I continuously get data from an NSTextField and do this in the background? I'm doing this because I'm using a quartz composer plugin to get posted values in an NSTextField. This is within the same app. Any ideas?? Elijah ...

textDidEndEditing: Objective c example

So I know you have to put this in the .h file: - (void)textDidEndEditing:(NSNotification *)aNotification BUT what do I call in the .m file?? How do I show that text is done editing in one of several NSTextFields? I looked around on the internet, but it seems pretty vague on how to use it correctly. Any ideas? Elijah ...

Objective c checking whether text field is empty

Here's the code: - (IBAction) charlieImputText:(id)sender { //getting value from text field when entered charlieImputSelf = [sender stringValue]; if (charlieImputSelf != @"") { (send field if not empty) } } This sends it even when the field is empty; therefore, this does not work as I want it to. Sorry...

Objective C implementation of controlTextDidChange: in .h and .m files

Can someone post the simplest example on how to use controlTextDidChange with a text label in the .h and .m files? Another part of my code constantly changes the value of this text label multiple times a second. I just need another part of my script that can tell if the value has changed and preform an action. All these websites out ther...

objective c javaScript

Is it possible for a NSTextField to respond to javascript commands?? Thanks! Elijah ...

Sending in values in a NSTextField: objective c

Ok, so I have an NSTextField and an NSSlider. In interface builder, I got the float value from the NSSlider to go into the NSTextField. BUT, I need a button that sends the text from the text field in so I can get the value in my code. That text field can also accept manual input so I cannot just link the NSSlider to my code. This is simi...

Objective C NSTextField keeps text in box highlighted when command is sent

When I press enter on an NSTextField to send what ever's in the text field, it sends it, but highlights what ever's in the NSTextField. Does anyone know how to make it so that once it sends the command in, it deletes what ever's in the NSTextField? Thanks, Elijah ...

Cocoa, NSTextField not noticing lost focus when pressing Tab?

I can't seem to find a way to get notified when an NSTextField loses focus by pressing the Tab key. I get a nice textDidEndEditing when clicking another control or when pressing Enter, but not if I change the focus by pressing the Tab key. Also tried to yank KeyDown and doCommandBySelector for this purpose but I got nowhere. Any ideas?...

NSTextField Color issues

I am dynamically adding a NSTextField to a window and am having issues with rendering. I am setting the background color to be black and the text color to be white. These both work but their is what appears to be a rectangle that is part of the text that is always white. Does anyone know what I might be doing wrong? How can I get rid of ...

iTunes Song Title Scrolling in Cocoa

I have searched extensively and cannot for the life of me find any information about how to achieve a similar effect to that of the iTunes song title scrolling if the text is too large in Cocoa. I have tried setting the bounds on a NSTextField to no avail. I have tried using NSTextView as well as various attempts at using NSScrollView. ...

Converting an NSComboBox to and NSTextField Easily

I have an NSComboBox and I was wondering if there is an easy way to convert it to an ordinary NSTextField? Considering NSCombBox is a subclass of NSTextField, I would think there is an easy way to turn this on/off but I can't figure it out. ...

I would like to insert token at the insertion point of the cursor, not the end of the array

I have a button that adds a token to a NSTokenField. It adds the token always to the end of the field: NSTokenField *currentField = [sender representedObject]; // Determine which token should be inserted into the field using the tag of the sender. switch( [sender tag] ) { case eFileNameToken_StartDate: ...

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 soon as I hit a key. It's not even getting into my setter methods, it just crashes with Pr...

multiple results of enter in an NSWindow

I have a multi-line textField in a window. I need the user to be able to hit return in the textfield for its normal purpose. I have a normal text field, that if the user hits return, I want it to just accept the text I also have an OKButton, that, if you're not in a textfield, i want return to do the OK button. Currently, wherever I a...

NSTextField cursor position

I'm trying to get the cursor position inside a NSTextField but so far unsuccessfully. Tried using [[myWindow fieldEditor:FALSE forObject:myTextField] selectedRange].location but no luck. Any ideas? ...

Focus NSAlert accessory item

I have an NSAlert item that uses an NSTextField as an accessory item to provide an prompt-like dialog box. The only problem that I have is that when the alert is ran the text field is not focused. I tried looking for a way to change NSAlert's first responder but found nothing. Is there a way to easy focus an accessory item in NSAlert? ...

How can i add menu items to the context menu of a NSTextField

I tried to overwrite the simple NSView method: - (NSMenu *)menuForEvent:(NSEvent *)event { NSMenu* result = [super menuForEvent: event]; NSMenuItem* mi = [[NSMenuItem alloc] initWithTitle: @"Foobar" action: @selector(foobar) keyEquivalent: @""]; [result addItem: mi]; return result; } but it does not work. It is never c...

Finding out the NSTextField for a field editor.

I' using - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject to provide my own field editor so i can display a custom context menu. This works but when inside the "menuForEvent:" method of my field editor, how can i find to which NSTextField it is attached? EDIT: okay i found that i get it via inside the Text...

Text formatting in NSTextField

I have a graphics app that uses a NSTextField instance for in-place text editing, this feature was added long time ago and I never had a reason to check it, however, I have recently received a report: text filed doesn't allow text formatting. Format -> Text menu subitems are all disabled, so there is no way to set the paragraph of a text...

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 function: - (BOOL)textView:(NSTextView *)aTextView shouldChangeTextInRange:(NSRange)affectedCha...