PPWW:'Poor Person's Word Wrap Routine for Associated Text Fields:'By Howard Wolowitz Copyright 1999 ALL RIGHTS RESERVED: :' USER MODIFY TWO LINES BELOW:'-----------------------------------------------------------------: : 'nf = Number of fields in associated note group:nf(3,.0)="5": : 'Point array to first field for correct number of fields:dim line(5)6: :'-----------------------------------------------------------------:' END OF USER AREA: ::pt(3,.0): : 'Get the Associated Field instance:ix(3,.0)=@af: : 'Get the current line into A:a=line(ix): : 'Get the Max line length:ln(3,.0)=len(a): : 'Clear out the pushkey string:oo="": :ix=nf 'No wrap of last line:goto okend '(No place to put it): loop:mid(a,ln,ln)="" 'check for a word wrap situation:goto okend '(Last character is not a blank): hasb:mid(a,"1",ln) co " " 'Does the Current line contain any blanks?:: :not hasb 'No blanks - can't word wrap:pt=ln+"1"; goto stor: : 'OK to wordwrap - Start at the end of the field:pt=ln-"1": :oo="" 'Save pushkey string (first time only):oo=os: : 'Start pushkey string:os="[crgt]": findb:mid(a,pt,"1") ne "" 'Find the last blank:pt=pt-"1"; os=os&"[crgt]"; goto findb: :oo ne "" 'Restore saved pushkey string (if any):os=oo: stor: 'Store off partial line:line(ix)=mid(a,"1",pt-"1"): :mid(a,pt+"1",ln) ne "" 'Put overflow into next line:b=mid(a,pt+"1",ln) < line(ix+"1") { "": :mid(a,pt+"1",ln) eq "" 'No overflow - word wrapping done:goto okend: : 'Point to next field:ix=ix+"1": : 'Store second line:line(ix)=b: :len(b) lt ln 'Anything left over - more word wrapping to do?:goto okend 'No - OKEND: :ix=nf 'Don't do last field:goto okend '(No place to put it): : 'get next field to test:a=b: : 'go test and fix next field:goto loop: okend: 'Finished...use pushkey field to move cursor over wrapped text:pushkey os: : 'Display changes:display: : 'Return to input processing:end: