Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Gorm: Editing a TextField - multiline support?

88 views
Skip to first unread message

Csanyi Pal

unread,
May 5, 2012, 12:25:51 PM5/5/12
to discuss...@gnu.org
Hi,

I'm using Gorm version 1.2.16 on a Debian GNU/Linux wheezy/sid system.

I'm building the interface of my small application project
'lpt-interface'. An image of this can be seen from here:
https://plus.google.com/u/0/photos/117283089154825941814/albums/5736149862706239553/5739083215646749922

On the image, In the Panel entitled as 'Tulajdonságok' (in English this
is Preferences) there are four TextFields. In the selected bottommost
textfield that is being edited, is the text cursor.

I want to put into it mutiline text, but when I hit Enter the editing
mode quit, so I can't go into next line of textfield to write more
text.

Can I edit this text field in Gorm as a multiline field?

--
Regards from Pal


Wolfgang Lux

unread,
May 6, 2012, 1:06:12 AM5/6/12
to Csanyi Pal, discuss...@gnu.org
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.

Wolfgang


Csanyi Pal

unread,
May 6, 2012, 4:38:38 AM5/6/12
to discuss...@gnu.org
Wolfgang Lux <wolfga...@gmail.com> writes:

> Csanyi Pal wrote:
>
>> I'm using Gorm version 1.2.16 on a Debian GNU/Linux wheezy/sid system.
>>
>> I'm building the interface of my small application project
>> 'lpt-interface'. An image of this can be seen from here:
>> https://plus.google.com/u/0/photos/117283089154825941814/albums/\
>> 5736149862706239553/5739083215646749922
>>
>> On the image, In the Panel entitled as 'Tulajdonságok' (in English this
>> is Preferences) there are four TextFields. In the selected bottommost
>> textfield that is being edited, is the text cursor.
>>
>> I want to put into it mutiline text, but when I hit Enter the editing
>> mode quit, so I can't go into next line of textfield to write more
>> text.
>>
>> Can I edit this text field in Gorm as a multiline field?
>
> 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?

--
Regards from Pal


David Chisnall

unread,
May 6, 2012, 4:44:45 AM5/6/12
to Csanyi Pal, discuss...@gnu.org
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


Fred Kiefer

unread,
May 6, 2012, 8:38:50 AM5/6/12
to discuss...@gnu.org
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

0 new messages