nstextfield

NSTextField in NSMenuItem

Hi am writing small app for posting twitts on twitter.com I manage to create statusbar icon next to clock and battery monitor, but now I am stacked... I wanted to add menu item text area max length of 140 chars, (4-5 rows text input field) something like spotlight but multi-rows (BTW I have got working class, to put and get twitts on t...

Input in menu item?

Hi! I would like to know if it is possible to have a NSTextField (for example) as a menu item in a menu. Your help will be very appreciated! Sweet day, —Albé ...

Why does the value of only one of my text fields change?

I have the following code: @interface AXWindowController : NSWindowController { IBOutlet NSTextField *text; IBOutlet NSTextField *otherText; } - (void) setText: (NSString *)input; - (void) setOtherText; @end @implementation AXWindowController - (void) setText: (NSString *)input { [text setStringValue:input]; } - (void) setOther...

Type in one field, show in two in Cocoa and Core Data

I have two controls (NSTextField and a NSTableView column) that are bound to the same attribute in core data. I've set up a timer that starts after the NSTextField starts editing and I'd like it to periodically commit the editing as the user is typing (type in one field, see it in both places). If the user hits the Enter key I do see t...

Data Detectors in Cocoa

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 ...

Force all capitals in NSTextField (Cocoa)

Hi, Is there a way to force capitals in a NSTextField? I want to create a text field for typing in Post Codes, and I want all post codes entered to use capital letters. e.g. N1 3ET instead of: n1 3et Also, I am using a regular expression, which only accepts capitals (I know very little about regular expressions, so I'm not keen on mod...

Can't paste (Command+V) into an NSTextField

For some reason, an NSTextField isn't allowing me to paste anything into it using Command+V, though I can paste into it if I right-click and click 'Paste'. Why is this happening and how do I fix it? ...

Getting NSTextField by tag number?

I've got a bunch of NSTextFields on a window (tagged 1-8) and I'm wondering if it's possible to access each individual text field programatically by its tag number so I can then get/set its value? I'm a newbie and while I know how to access these fields by name, doing it by tag number will make things an awful lot simpler for what I'm t...

Which NSTextView is the First Responder?

I'm working on a Cocoa programming exercise, and I need to be able to determine which of two NSTextView objects is currently being edited. I think it's something to do with finding the first responder and checking to see if it's equal to one text field or another, but I can't quite get it to work. Any help would be appreciated. ...

Why do hyperlinks sometimes not show in an NSTextField with an NSAttributedString?

The text I use in an NSTextField is loaded from a file as follows. NSString *path = [[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"]; NSAttributedString *as = [[NSAttributedString alloc] initWithPath:path documentAttributes:NULL]; [creditsLabel setAttributedStringValue:as]; [creditsLabel becomeFirstResponder]; The hyp...

Unable to write to NSTextField from Model Controller object

After always running monolithic blocks of code from within my AppController object, I've just learned how to modularize my code using separate model controller objects (so much neater and less confusing to work with :-)) My simple test app has a main AppController and two model objects (Model1 and Model2). I can successfully pass data f...

NSTextField rec'd focus?

How can I know when an NSTextField has rec'd focus? Is there a delegate method that will tell me when the user has clicked the mouse in (or otherwise selected) my NSTextField? thanks tom ...

selectText of NSTextField on focus

Hi Could anybody suggest a method to select all the text of an NSTextField when the user clicks it ? I'm new to Cocoa, and could not find a solution here or on the web. I did find suggestions to subclass NSTextField and then use mouseDown or firstResponder, but it's beyond my skill for now. So I was hoping either there would be an easi...

NSTextField - White text on black background, but black cursor

Hi I've setup an NSTextField with text color as white, and the background color as (black despite not rendering the background color, so its transparent). All in Interface Builder. The problem I am having is the cursor is black, and hardly visible. Does the cursor not represent the text color? Any ideas how I can fix this? Otherwise t...

Forcing a text field to end editing Cocoa OSX

I have a view based gui that contains a text field for each gui item. When I select another menu item I want my text fields to exit out of editing mode. I could not find anyway to do this in the nsTextField docs. Any ideas? ...

looking for a better way to activate and deactive background of text fields in my GUI (Cocoa OSX)

I have a small gui app that consists selectable groups, each groups has a disclosure button to display its sub-group, an image and a text field. When you are editting a text field and select another group or another text field I want to end editting on the old text field. Also, I only want the background of a text field to be display w...

No events such as 'Editing did Change' for a NSTextField?

When I developed for the iPhone I had multiple events on touch that could be true for a button. (e.g. Editing did Change, Editing did End …) Now that I develop for Mac OSX I want my application to recognize multiple events in a NSTextField. How to do that? Is there an alternative for the events? Thanks! EDIT: May delegates be the ke...

Accessing views from within NSTextField Category?

I've got several different classes in my code utilising identical methods -- resulting in a lot of duplicated lines -- and I recently found out about adding Categories which promises an effective solution to the problem. To give one of the smaller examples, my previous methods were (typically) called in the traditional way like this: if...

NSTextField or NSTextView?

Could someone explain to me what are the main differences between NSTextField and NSTextView? I know that NSTextView has more features and is usually used for longer texts, and NSTextField is usually used for one-line plain text fields, but if I understand correctly, NSTextField can be also used with attributed strings and with multiple ...

Preventing an NSTextField from becoming active (Cocoa OSX)

I want my NSTextFields in my GUI to act like the text fields in the apple finder (the text only becomes active for editing if the text is clicked on when the item is selected). I tried overwriting the mousedown method of the NSTextField to prevent the selection but this did not do the trick. What method do I need to override to accompl...