Yep
Yep

Reputation: 653

Multi-line NSTextFields

I want to know how to do something like Adium does, where when you type more text than the field can handle it expands into a new line. Like this:

enter image description here

Either how can I do this, or where in the Adium source code can I find this?

Upvotes: 1

Views: 1565

Answers (2)

Peter Hosey
Peter Hosey

Reputation: 96323

The view in Adium is AIMessageEntryTextView, plus its superclasses AISendingTextView and AITextViewWithPlaceholder, and the actual resizing (as opposed to figuring out the right size as a hypothetical ideal) is done by AIMessageViewController in response to AIViewDesiredSizeDidChangeNotification.

Do note that Adium is licensed under GPLv2, so unless you intend to use the same license when releasing your own project, you can't lift any of Adium's code for this purpose.

Upvotes: 2

cwoebker
cwoebker

Reputation: 3288

I am not exactly sure what Adium itself does there. But I am pretty sure that you could just use NSTextView.

You can find it at the Apple Developer website.

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSTextView_Class/Reference/Reference.html

Furthermore this Tech note for using NSTextField, if anyone wants to do the extra work. ;-) http://developer.apple.com/library/mac/#qa/qa1454/_index.html

Upvotes: 1

Related Questions