processing of the result of a INKEY$
Posted: Sun Aug 01, 2021 6:46 pm
Hi,
I am doing a text editor in Basic. I have a loop where during a certain count, the current position of the insertion point flashes, its a cursor to indicate to the user where the next letter will appear when typed in the keyboard.
The keys are read by the use of INKEY$. Inside this loop when a count of 25 is reached the character at the insertion point is a dark square (the graphical character), when it reaches 50 it is a space. When nothing is being typed, this implements a flashing cursor.
On one of the lines of the loop (after determining the character of the cursor), i check if INKEY$ is <>"". If it is, then a key has been pressed. I then jump to a subroutine with GO SUB that actually prints the character at the position of the cursor. it then returns and jumps to the beggining of the loop where the current position in the line is incremented.
Now, with this increment, the cursor is supposed to start flashing on the character position to the right of the character that was just typed in. This happens if I type slowly the new text. If I type faster, the current cursor's character is left in the position where the new character would be.
I don't understand this behaviour because :
- I detect a keypress
- I print the letter pressed at position x,y
- I increment the y coordinate
- I print the current cursor character at the new y position that was just incremented
Seems like the key is printed but before the advancement of the y coordinate, the cursor flashes and the key pressed is replaced by it.
But followinf the list I wrote above, how can this happen ?
If someone willing to help. I can put the actual code here (its small), I just have to copy it by hand from the screen to some textfile on my laptop, because I am saving the program to a server using the spectranet interface.
Thanks for any help,
Regards
I am doing a text editor in Basic. I have a loop where during a certain count, the current position of the insertion point flashes, its a cursor to indicate to the user where the next letter will appear when typed in the keyboard.
The keys are read by the use of INKEY$. Inside this loop when a count of 25 is reached the character at the insertion point is a dark square (the graphical character), when it reaches 50 it is a space. When nothing is being typed, this implements a flashing cursor.
On one of the lines of the loop (after determining the character of the cursor), i check if INKEY$ is <>"". If it is, then a key has been pressed. I then jump to a subroutine with GO SUB that actually prints the character at the position of the cursor. it then returns and jumps to the beggining of the loop where the current position in the line is incremented.
Now, with this increment, the cursor is supposed to start flashing on the character position to the right of the character that was just typed in. This happens if I type slowly the new text. If I type faster, the current cursor's character is left in the position where the new character would be.
I don't understand this behaviour because :
- I detect a keypress
- I print the letter pressed at position x,y
- I increment the y coordinate
- I print the current cursor character at the new y position that was just incremented
Seems like the key is printed but before the advancement of the y coordinate, the cursor flashes and the key pressed is replaced by it.
But followinf the list I wrote above, how can this happen ?
If someone willing to help. I can put the actual code here (its small), I just have to copy it by hand from the screen to some textfile on my laptop, because I am saving the program to a server using the spectranet interface.
Thanks for any help,
Regards