Page 1 of 1

TRichview and auto set focus

Posted: Mon Mar 19, 2007 1:42 pm
by Fishous
I'm using a TRichViewEdit as a chat text control. The problem I am having is that certain operations, such as scanning for URLs makes the control set focus to itself, which is really annoying when you're trying to type in another control.

I'm using HTML and the HTML Importer, as well as a scan url procedure.

Is there any way to prevent SetSelectionBounds from setting the focus to the control? It makes programatic adding of text impossible to work with.

Posted: Mon Mar 19, 2007 7:17 pm
by Sergey Tkachenko
Yes, some editing operations and operations with selection can move focus to the editor.

But HTML importer and url scanning must not do it. I'll check tomorrow.

Posted: Mon Mar 19, 2007 9:29 pm
by Fishous
Well, while you're at it, check and see if it makes it automatically scroll to the end. I removed rvoScrollToEnd from the RichEdit Options, and when I import the table, it still scrolls to the end.

I'm "basically" doing this:

FRichView.ReadOnly := false;
FRVHtmlImporter.LoadHtml(Content.BodyExtended);
FFirstAdd := false;
FRichView.FormatTail;
ScanForURLS;
FRichView.FormatTail;
FRichView.ReadOnly := true;

I did modify the scanForUrls to work on just the recently added HTML, since scanning from the beginning of the document caused issues.