You scroll using the scrollRectToVisible() method.
You can get the Rectangle using the modelToView() method.
Joined: Mar 07, 2004
It doesn't seem to work. I tried to enter in the position of the caret (which is right before the word I want to have focused) as the argument for modelToView(), however upon running, nothing changed. I then tried entering various arbitrary values in, all to no effect. What exactly am I missing?
Code is as follows:
As a small bit of explanation, the word that I want focus on is ex2. ex1 contains a large amount of text, enough to put ex2 off screen, but I deleted it for shortness.
Joined: Jun 13, 2009
The viewport will only scroll when the rectangle is not in the current view. So create a simple test with 10 lines of data and set the viewport size to only display 3-4 lines of data. Then calculate the start of line 5-6 and attempt to force the viewport to scroll.