info-mac@uw-beaver (info-mac) (08/07/84)
From PATTERMANN@SUMEX-AIM.ARPA Mon Aug 6 17:09:40 1984 Some time ago somebody asked how to build a window that would scroll text. This is made difficult since as you start to fed text into a TEHandle it starts at the top of the window and then autowrap causes a number of lines to occur that is possibly different than the number of return characters. One solution is to make the number of return characters be the same as the number of lines by making the rectangle that text is draw into very wide. Getting wrap on character boundaries instead of word boundaries is more difficult. All of this aside the way to scroll a window is to use line hieght, and number of lines which are stored in the TERecord along with the hieght of the window, which is computable from the port rectangle of the window. These items will allow you to comute the vertical pos. of the insertion point, as well as how many lines you want to remove. Then TEDelete from zero to a value taken out of the line ends array will cause the scrolling. Once you have done the delete you have to reset the insertion point to infinity, so the next character you insert will be at the bottom of the window. Ben Hyde -------