Find insertion point position

Example:
I have a text field in a table view containing:
“This is a text which is too long in regards of characters”
The idea is to place the insertion position before the “in”, hit a button and a new table row will be generated.
The existing one will keep the text "This is a text which is too long ", the new one “in regards of characters”

You may be better off using a text view rather than a text field. You could also try using the window method -fieldEditor:forObject: to return the field editor, and then get its selectedRange.

I would love to use a text view instead, but I can’t assign “textDidChange:” to it which I do need to update other row values.
And for the “fieldEditor” I have no idea how to work with that.

Moving the second line to a new row will cause the CPS to be changed the Par. Count, the Max Char. and the Gap.
Or with a given CPS preset everything except In will change

The NSTextView class communicates with its delegate through methods declared both by the NSTextViewDelegate and by its superclass’s protocol, NSTextDelegate.

That gives you textDidChange:. The textView:doCommandbySelector: method might be even more useful — check the selector, and if it’s insertNewline: you can update the paragraph count. No button needed.

Hmm,

I haven’t found a way to make textDidChange: work with a text view.

Regarding the paragraph count I don’t use a button,
It’s triggered by the text field’s textDidChange:
It’s not only the count of paragraphs which is needed. You need the character count of each line, the highest value is relevant. Additionally the total amount of characters is needed to calculate the reading speed in “characters per second” or for some languages a “words per minute”. Both are based upon the time values stored in the row’s record.

Do you mean the one above the table? If so, it sounds like you haven’t made the delegate connection properly in IB.

I didn’t realise I’ve to make it delegate in the popup. Expected to see a “textDidChange” available.