Thanks for your reply.
Two things -
1) it is needed on a SDV as there are other fields from the Database that will need updating and they are on the SDV.
2) I have tried the approach with using view-as Editor but the problem with that is - with word wrap being set on the editor box, CHR(10) only occurs if the user presses a RETURN - the editor box does all the formatting of the text. So to move it to line[1], line[2] etc seems to be impossible, not unless there is a way to get the screen image line by line into the array.
Regards
When you put an editor widget on the screen and you allow wordwrap then the next procedure can help you put all the seperate lines into your extent variable. You can set the max-chars attribute so that the user will not enter to large texts ;-)
Here is the procedure, I hope it will help you to solve the problem. I have put an editor and a button on a window. When I press the button it will invoke this procedure.
PROCEDURE readEditorTextIntoTekstArray:
DEFINE VARIABLE iCnt AS INTEGER NO-UNDO.
DEFINE VARIABLE cTekst AS CHARACTER FORMAT "x(48)" EXTENT 3 NO-UNDO.
DEFINE VARIABLE iStart AS INTEGER NO-UNDO.
DEFINE VARIABLE iEnd AS INTEGER NO-UNDO.
/* editor-1:max-chars = 144 ( 3 lines, 48 characters ) */
DO WITH FRAME {&FRAME-NAME}:
/* Loop through all the lines in the editor widget */
DO iCnt = 1 TO editor-1:NUM-LINES:
/* When it is the first line the startposition is always 1 */
IF iCnt = 1 THEN ASSIGN iStart = 1.
/* If it is not the startposition then the new startposition is the previous end position + 1 */
ELSE ASSIGN iStart = editor-1:CURSOR-OFFSET + 1.
/* If there are more lines then place the cursor on the next line to find the last position of the previous line */
ASSIGN editor-1:CURSOR-LINE = IF editor-1:NUM-LINES > iCnt THEN iCnt + 1 ELSE iCnt
editor-1:CURSOR-CHAR = 1
/* The end position of the line is the cursor offset - 1, or if it is the last line, 144 */
iEnd = IF editor-1:NUM-LINES > iCnt THEN editor-1:CURSOR-OFFSET - 1 ELSE 144.
/* Now we can select the line */
editor-1:SET-SELECTION(iStart,iEnd).
/* And assign the selection to the variable with extent iCnt */
cTekst[iCnt] = ENTRY(1,editor-1:SELECTION-TEXT,"~n").
END.
/* Clear the selection so the user will not see anything of it */
editor-1:CLEAR-SELECTION().
END.
/* Show the array in a message box */
MESSAGE cTekst[1] SKIP cTekst[2] SKIP cTekst[3]
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END PROCEDURE.