RichEdit VCL and URLs. Workarounds for OnPaint Issues.

Posted by HX_unbanned on Stack Overflow See other posts from Stack Overflow or by HX_unbanned
Published on 2010-01-31T09:43:02Z Indexed on 2010/06/03 6:04 UTC
Read the original article Hit count: 318

Filed under:
|
|
|
|

So, issue is with the thing Delphi progies scare to death - Rich Edit in Windows ( XP and pre-XP versions ).

Situation:

I have added EM_AUTOURLDETECTION in OnCreate of form. Target -> RichEdit1. Then, I have form, that is "collapsed" after showing form. RichEdit Control is sattic, visible and enabled, but it is "hidden" because form window is collapsed. I can expand and collapse form, using Button1 and changing forms Constraints and Size properties.

After first time I expand form, the URL inside RichEdit1 control is highlighted.

BUT -

After second, third, fourth, etc... time I Collapse and Expand form, the RichEdit1 Control does not highlight URL anymore.

I have tried EM_SETTEXTMODE messages, also WM_UPDATEUISTATE, also basic WM_TEXT message -> no luck. It sems like this merssage really works ( enables detection ) while sending keyboard strokes ( virtual keycodes ), but not when text has been modified. Also - I am thinking to rewrite code to make RichEdit Control dynamic. Would this fix the problem?

Maybe solution is to override OnPaint / OnDraw method to avoid highlight ( formatting ) losing when collapsing or expanding form?

Weird is that my Embarcadero Documentation says this function must work in any moment text has been modified. Why it does not work?

Any help appreciated. I am making this Community Wiki because this is common problem and togewther we cam find solution, right? :)

Also - follow-ups and related Question:

http://stackoverflow.com/questions/738694/override-onpaint

http://stackoverflow.com/questions/478071/how-to-autodetect-urls-in-richedit-2-0

http://www.vbforums.com/archive/index.php/t-59959.html

© Stack Overflow or respective owner

Related posts about delphi

Related posts about api