Here's an example that works with more than 255 characters in a field.
WINDOW 1
ed$ = "Hello Al." + CHR$(13) + "You're the greatest!"
ed$ = ed$ + CHR$(13) + "Thanks for sending this."
ed$ = ed$ + CHR$(13) + CHR$(13) + "Press mouse to continue."
EDIT FIELD 1, ed$, (10,10)-(200,300)
WHILE FN BUTTON = 0
HANDLEEVENTS
WEND
dum$ = ""
nlines = 0
GET FIELD txtH&, 1
LineWeWant = 2 ' this is the line of text to grab
LONG IF txtH&
osErr = FN HLOCK (txtH&)
size& = FN GETHANDLESIZE(txtH&)
nlines = 1
FOR X = 2 TO size& - 1
dum$ = CHR$(PEEK([txtH&]+ X))
LONG IF dum$ = CHR$(13)
nlines = nlines + 1
LONG IF nlines = LineWeWant + 1
X = size&
XELSE
textArray$ = ""
END IF
XELSE
textArray$ = textArray$ + dum$
END IF
NEXT X
osErr = FN HUNLOCK (txtH&)
DEF DISPOSEH(txtH&)
END IF
EDIT FIELD CLOSE 1
DELAY 500
CLS
PRINT "Line " LineWeWant " = ";
PRINT textArray$
PRINT : PRINT "----------"
INPUT "Press RETURN to end"; X$
END
Al Staffieri Jr.
See if this will do what you want. I think it's a little more direct than some of the other approaches suggested. It may be buggy, as it just oozed off the top of my head, but it should be close.
I didn't go into great length documenting what this does--If it doesn't make sense to you, please ask.
LOCAL FN get1Line$(editFieldID,line2Get)
teH& = TEHANDLE(editFieldID)
SELECT
CASE line2Get < teH&..teNLines
nextLine = {[teH&]+_teNLines+line2Get+line2Get+2}
CASE line2Get = teH&..teNLines
nextLine = teH&..teLength%+1
CASE ELSE
BEEP
PRINT "There is no line";line2Get;"."
foundLine$ = "ERROR"
EXIT FN
END SELECT
lineOffset = {[teH&]+_teNLines+line2Get+line2Get}
lineLength = nextLine - lineOffset-1 'omit CR
IF lineLength > 255 THEN lineLength = 255
POKE @foundLine$, lineLength
BLOCKMOVE [teH&..teTextH&]+lineOffset,@foundLine$+1,lineLength
END FN = foundLine$
Jay.