In WPT5 I did not need to use SetFocus. I was just trying to figure out why I have to manually focus the WPRichText in WPT9 using the standard dialog. Still haven't figured that out yet. The manual focus only works after the standard dialog itself (not your OnSerchReplaceMessage event) reports that it didn't find anything (even thought there is a match). After that dialog, I can click in the WPRichText and select find, and it works until the next load of the WPRichText.
I tried your new dialog, and that issue is not present which is good, but have other questions/problems:
Why does TWPSearchReplaceDialog always start with the Replace checkbox set even though my options are all cleared? I might want to find, not replace:
WPSearchReplaceDlg1.Options := [];
I ended up replacing my first few test texts with blank when I thought I was just doing a find. But was lucky it didn't save because the replace didn't invoke the OnChange event, which is a problem in itself.
When doing a replace, the Count parameter in the OnSearchRepalceMessage is always 0. What is this Count? I can't find anything in the documentation, sorry.
Is there a way to autofill the search box? For example, if my text cursor is on a word, I'd like to just do a CRTL+F and the dialog pops up with that word (WPRichText1.CPWord) in the dialog.
One last thing for future consideration in your dialogs...
As I've mention in the past, it would be nice if you allow the programmer to decide where the dialog should show up. Currently it always shows up in the top left corner, which is not nice on a 4K 40" monitor when my app is a relatively small form in the middle of the monitor. Like the old baseball reference "out in left field" in the literal sense. ;)