richedit

RichEdit does not process hyperlinks

核能气质少年 提交于 2020-01-02 11:05:43
问题 I want my RichEdit to process hyperlinks, so I followed the instructions on: http://delphi.about.com/od/vclusing/l/aa111803a.htm Here are the changes I made to the code: interface type TProgCorner = class(TForm) RichEdit2: TRichEdit; RichEdit1: TRichEdit; RichEdit3: TRichEdit; RichEdit4: TRichEdit; procedure FormCreate(Sender: TObject); private procedure InitRichEditURLDetection(RE: TRichEdit); protected procedure WndProc(var Msg: TMessage); override; end; implementation {$R *.DFM} uses

Scrolling RichEdit without it having focus

半世苍凉 提交于 2020-01-02 03:54:06
问题 I need to scroll a RichEdit to the very end after a line is added. I have this RichEdit in a separate form, that I don't want to get focus at all. I tried often suggested solution: RichEdit.Lines.Add(someText); RichEdit.SelStart:=RichEdit.GetTextLen; SendMessage(RichEdit.handle, EM_SCROLLCARET, 0, 0); But this doesn't work for me. However, when I focus the RichEdit before calling the SendMessage using RichEdit.SetFocus; it works just fine. That, however, ruins my other needs for the app. I'm

How to get text extent of RichEdit in Delphi

旧时模样 提交于 2019-12-31 02:01:52
问题 Does anyone know how to get the width and height of text in a TRichEdit control, in the same way that you would use TextWidth and TextHeight on a TCanvas? The reason I need to know this doing this is I have a RichEdit on a non-visible form that I copy the contents of to a canvas using Richedit.Perform(EM_FORMATRANGE, ...). The problem is that the EM_FORMATRANGE requires a parameter of type TFormatRange in which the target rect is specified, but I don't know what the rect should be because I

Spurious '\r' added by CRichEditCtrl::GetLine() when called on single-character lines?

筅森魡賤 提交于 2019-12-24 02:22:47
问题 I tried using CRichEditCtrl::GetLine() to retrieve the text of a given line of a rich-edit control in an MFC application built with VS2015 in Unicode mode, and running on Windows 10. I wrote this helper function: CString GetLine(CRichEditCtrl& richEdit, const int lineNum) { int lineLength = richEdit.LineLength(richEdit.LineIndex(lineNum)); if (lineLength == 0) { // Empty line return CString(); } const int kMinBufferLength = sizeof(int) / sizeof(wchar_t); const int bufferLength = max

Hiding caret in RichEdit winapi

假如想象 提交于 2019-12-23 02:19:30
问题 I would like to hide a caret from a RichEdit(50W) with ES_READONLY style specified. It's pretty confusing for the user, when the caret is blinking and the user can't type. I tried to hide the caret using HideCaret() function, however it doesn't work for me with following code: LRESULT CALLBACK ChatMessaegsSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) // Subclassed control { LRESULT ret = CallWindowProc(WndProc_ChatMessages, hwnd, msg, wParam, lParam); switch(msg) { //Also

Why am I getting RichEdit line insertion error when I call Delete in OnChange event?

試著忘記壹切 提交于 2019-12-22 11:10:49
问题 I've googled and checked many places for a solution, but all cases I found differed or involved something more advanced than simply adding or deleting lines. Basically, I want to make a sort of scrolling rich edit (alternative would be moving the caret to the bottom, which I already found a solution for). I'm adding lines to it and checking Lines.Count with the OnChange event of the rich edit and as soon as it reaches value greater 15 I want to call Lines.Delete(0) , however I get the error:

Change highlight color of selected text in RichEdit

狂风中的少年 提交于 2019-12-21 22:00:53
问题 How do I change the color of selected text in a RichEdit control, while the text is being selected? SetSysColor() can do it, but that changes the Highlight-color globally. Setting a CHARFORMAT2 with SCF_SELECTION, and sending a EM_SETCHARFORMAT does change the font and background color. But is only visible once you deselect the same range. That's not really helpful, since I want it to be the original color again once something is deselected. So, how it's really done puzzles me. 回答1: Simply

How to autodetect urls in RichEdit 2.0?

[亡魂溺海] 提交于 2019-12-20 06:36:53
问题 When we have a RichEdit control and send it an EM_AUTOURLDETECT message with WPARAM set to TRUE, it nicely hightlights the detected URLs and sends the EN_LINK notifications. But it does this only for text that is entered into the control. I haven't found the way to do it for text that's loaded into the control with SetWindowText or EM_STREAMIN . Please help! Thanks Upd: I've created a test application from scratch and it works fine there. I think the problem might be that I have superclassed

Unicode RTF text in RichEdit

泪湿孤枕 提交于 2019-12-18 02:49:17
问题 I'm having trouble getting a RichEdit control to display unicode RTF text. My application is Unicode, so all strings are wchar_t strings. If I create the control as "RichEdit20A" I can use e.g. SetWindowText, and the text is displayed with the proper formatting. If I create the control as "RichEdit20W" then using SetWindowText shows the text verbatim, i.e. all the RTF code is displayed. The same happens if I use the EM_SETTEXTEX parameter, specifying codepage 1200 which MSDN tells me is used

Rich Edit Control in raw Win32

拜拜、爱过 提交于 2019-12-14 01:38:49
问题 Is the documentation for Rich Edit Controls really as bad (wrong?) as it seems to be? Right now I'm manually calling LoadLibrary("riched20.dll") in order to get a Rich Edit Control to show up. The documentation for Rich Edit poorly demonstrates this in the first code sample for using Rich Edit controls. It talks about calling InitCommonControlsEx() to add visual styles, but makes no mention of which flags to pass in. Is there a better way to load a Rich Edit control? http://msdn.microsoft.com