Cursor positioning
- Posted by alrobnett <alrobnett at alumni.princeton.edu> Jan 09, 2004
- 407 views
I am displaying 63 8-character words in various locations on screen and allowing the user to maneuver over them by arrow presses. The various lineno's, and positions are stored in the sequence rn_loc = {{1,37,"%8s"...}, {2,16,"%8s"....}, {2,58,"%8s.."}, ... } (Actually, each sequence element contains some additional word selection and formatting information, but this is the main idea) A "for" loop. 1 to 63, does a beautiful job of positioning and displaying the array: Essentially it is: lineno = 1 pos = 2 format = 3 for word_nmbr = 1 to 63 do position(rn_loc[word_nmbr][lineno], rn_loc[word_nmbr][pos]) printf(1, rn_loc[word_nmbr][format], and code to select the word) end for At the conclusion, the user manuevers to a chosen word via arrow keys. I want the cursor to appear at the beginning of the word. The code I used is position(rn_loc[word_nmbr][lineno], rn_loc[word_nmbr][pos]) printf(1, "%1s", " ") The cursor appears on the correct line, but near the left of the screen. If I substitute explicit line and pos numbers, it works correctly. position(2, 40) printf(1, "%1s", " " Trace will not show me rn_loc[word_nmbr][pos], but the entire sequence, rn_loc, still appears to be inact. The puzzle is that it has just finished using the sequence data to locate and print the words, why not the cursor posion? Allen