Posted 15 years ago
by RS
I'm implementing our Find Replace functionality with SyntaxEditor and have hit a minor problem.
After executing a FindNext (on activeview.currentsnapshot - is that the way I should be doing it) I set ActiveView.Selection.TextRange to the first find result TextRange and then call ActiveView.Scroller.ScrollToCaret. This sometimes leaves the selection off the edge of the visible area - is there a better way to ensure the selection is visible (preferably in the middle of the view), or perhaps another way to call FindNext that takes care of this?
The behavior of ReplaceNext seems a bit odd in that it does a find and then replaces the first find - is there functionality equivalent to clicking Replace on a Find Replace dialog - that replaces the selection if it's the text being searched for and then moves the selection point to the next result. Perhaps I'm missing the idea of ReplaceNext?
After executing a FindNext (on activeview.currentsnapshot - is that the way I should be doing it) I set ActiveView.Selection.TextRange to the first find result TextRange and then call ActiveView.Scroller.ScrollToCaret. This sometimes leaves the selection off the edge of the visible area - is there a better way to ensure the selection is visible (preferably in the middle of the view), or perhaps another way to call FindNext that takes care of this?
The behavior of ReplaceNext seems a bit odd in that it does a find and then replaces the first find - is there functionality equivalent to clicking Replace on a Find Replace dialog - that replaces the selection if it's the text being searched for and then moves the selection point to the next result. Perhaps I'm missing the idea of ReplaceNext?
RS