discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gorm: Editing a TextField - multiline support?


From: Fred Kiefer
Subject: Re: Gorm: Editing a TextField - multiline support?
Date: Sun, 06 May 2012 14:38:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120421 Thunderbird/12.0

On 06.05.2012 10:44, David Chisnall wrote:
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.

In general Wolfgang and David are correct. For displaying multiline text an NSTextView is better suited. Nevertheless, NSTextField should do the trick, as soon as you are able to get the multiline text into it. Normally I would recommend to write the text in another editor and copy it into Gorm, but at least for me this wont work.

I am completely ignorant of the relevant Gorm code here, but this code seems to need an adjustment. It would also be possible to have a delegate set up for the text field in Gorm that would allow newlines to be added to the text. Perhaps somebody with more knowledge on Gorm could do this.

Please feel free to add an enhancement request into our bug tracker.

Fred



reply via email to

[Prev in Thread] Current Thread [Next in Thread]