[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Gorm: Editing a TextField - multiline support?
From: |
David Chisnall |
Subject: |
Re: Gorm: Editing a TextField - multiline support? |
Date: |
Sun, 6 May 2012 09:44:45 +0100 |
On 6 May 2012, at 09:38, Csanyi Pal wrote:
>> NSTextField is designed to enter short text which (usually) fits on a
>> line. If you want multi-line input you should be using a NSTextView
>> instead.
>
> Actually what I want is a multiline output for Help text that should be
> shown to the user. How can I achieve this goal?
As Wolfgang said, use an NSTextView. You can set it to non-editable if you
just want to display text.
NSTextField is a slightly ugly hack left over from when a high-end workstation
had 8MB of RAM and having a few KB of state for every text field in a window
would have made you run out of memory quickly. All text fields share a text
view (technically, some NSText subclass, but in practice typically an
NSTextView) that they each use for drawing and editing one at a time. When you
select an NSTextField[Cell], it acquires temporary ownership of this instance
(the field editor) and uses it to draw and handle events.
This is most important when you have something like an NSTableView with an
NSTextFieldCell in every row or a very large form in an NSScrollView. You
could quickly run out of memory on an older machine if every single one of
these was a separate NSTextView.
For large amounts of text, you should just use an NSTextView directly.
David
-- Sent from my IBM 1620