Thats brilliant, George!! Thank you. We're getting pretty close now..
Pressing Enter correctly inserts a CRLF in the correct location and moves the curser to the correct location as well, both in the middle and at the end of a line.
The only problem is, if the curser is at the end of a line and you press enter, the curser does not appear to move. If you continue typing, the curser jumps down to the next line and writes from there. It would be a little confusing to a user who may hit enter several times and wonder why the curser isn't moving, but its a heck of a lot better then anything we've had before now.
Copy and paste the program into MyEdit and give it a try. You can even change the size of the multi-line text box by changing the parameters at the top.
Any ideas for how to fix the curser problem??
Here's what I've tried so far: I can get the curser to move to the next line down by adding an additional character, such as a "." after the crlf$, and placing the curser between the crlf$ and the ".". That works, but of course the document fills up with dots. To see it, unremark the comment at the end of line 240 below.
So then I tried with an invisible character but the problem is the characters that are invisible in standard ASCII are not the same characters that are invisible in gui mode.. The invisible characters in gui mode depend on your font and they're different for every font. Chr$(1), invisible in the font I was using, worked exactly half the time.
Now all I have to do is get the up and down arrows working and we're in business!!!
Gabriel
Code: Select all
00100 dim X$*1000, Y$*20
00110 !
00120 let Width=60
00130 let Height=8
00140 let position=-1 ! First time around, start at beginning
00150 !
00160 let Cr$=Chr$(13) : let Lf$=Chr$(10) : let Crlf$=Cr$&Lf$
00170 open #1: 'srow=5,scol=5,rows=10,cols='&Str$(Width),display,output
00180 !
00190 do
00200 rinput #1,fields '1,1,V '&Str$(Width*Height)&','&str$(position+2)&';10,1,V 20': x$,Y$
00210 !
00220 if Curfld=1 then ! If we're in a multi-line textbox field
00230 let Position=(((Currow-1)*Width)+Curcol) ! find the position
00240 let X$(Position:Position-1)=Crlf$ ! &"."
00250 end if
00260 !
00270 loop Until Fkey=99