views:

207

answers:

1

Hi,

I have a NSTokenField object with multilines (just resized the control vertically in interface builder). Unfortunately the NSTokenField object does not insert new line when pressing the return key. Any ideas how to make the control insterting a new line when pressing the return key?

Do I really have to go the complicated way through delegates like control:textView:doCommandBySelector: ?

Thank you.

+1  A: 

By default, text fields (and by extension token fields) do not insert a new line when pressing the return key. This is the expected behavior.

A user who wishes to enter a return instead of tokenizing or committing the input may press Option-Return.

If you wish to disable this behavior programatically (be careful not to break the user's expectations) then the delegate is by far the easiest way to do so.

Jim Correia
imo the user expectation is inserting a new line when pressing the return key if the text field has more then one line. The multi line label listed in the IB palette (which is new in IB 3.0) inserts indeed a new line when pressing the return key.
cocoafan