Posted 19 years ago
by Blair Leggett

Hi,
I'm writing an application where I would like to remember where a user last editied a file on shutdown, and then when they relaunch that application their cursor is placed back exactly where they left it.
(Baring any missing lines or other problems which can be ignored for the moment)
I'm able to place the Caret in the exact location using Caret.Offset & GoToLine.
But what I'd really like to do is reposition the editor in the exact way using the displayLinesAbove parameter in the GoToLine method.
But I don't know how to find out how many lines were above the Caret when the user shut the application down. So when I reload their document, it is not in the same vertical position on screen; although, the cursor is in the exact same position.
Does anyone have any ideas on how I would be able to figure out the Screen placement of the Caret, so that I can pass the correct displayLinesAbove into the GoToLine method on reboot?
Thanks,
Blair
I'm writing an application where I would like to remember where a user last editied a file on shutdown, and then when they relaunch that application their cursor is placed back exactly where they left it.
(Baring any missing lines or other problems which can be ignored for the moment)
I'm able to place the Caret in the exact location using Caret.Offset & GoToLine.
But what I'd really like to do is reposition the editor in the exact way using the displayLinesAbove parameter in the GoToLine method.
But I don't know how to find out how many lines were above the Caret when the user shut the application down. So when I reload their document, it is not in the same vertical position on screen; although, the cursor is in the exact same position.
Does anyone have any ideas on how I would be able to figure out the Screen placement of the Caret, so that I can pass the correct displayLinesAbove into the GoToLine method on reboot?
Thanks,
Blair