<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Nov 3, 2016 at 3:52 PM, Dmitry Boyarintsev via Lazarus <span dir="ltr"><<a href="mailto:lazarus@lists.lazarus-ide.org" target="_blank">lazarus@lists.lazarus-ide.org</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">On Wed, Nov 2, 2016 at 10:25 PM, silvioprog via Lazarus <span dir="ltr"><<a href="mailto:lazarus@lists.lazarus-ide.org" target="_blank">lazarus@lists.lazarus-ide.org</a><wbr>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="gmail-m_-2710865676954877220gmail-"></span><div></div><div>I had some ideas, and I can send small patches showing them. For example, what do you think about adding the GetLink() method in the TCustomRichMemo class and the href:string attribute in the TLinkMouseInfo record? </div></div></div></div></blockquote></span><div><br>You might want to refer to SetLink method.<br></div></div></div></div></blockquote><div><br></div><div>So so, SetLink applies/removes a link, GetLink have a diferente purpose, it just returns the link's URL. (even in <a href="https://blogs.msdn.microsoft.com/murrays/2009/09/24/richedit-friendly-name-hyperlinks/">friendly name hyperlinks</a>) :-)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>There's ALinkRef parameter, that serves this particular purpose. </div></div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>Naturally, LinkRef should end up in TLinkMouseInfo .<br></div></div></div></div></blockquote><div><br></div><div>Perfect.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>But I'd like to note, that "Links", are yet "under construction" area. For a few reasons:<br></div><div>* old win32 rich edit (for WindoesXP, doesn't have an api to read "href" data. However, a raw access to RTF could be used to extract it... as well as to store it)<br></div><div>* setting up a link >>might<< (not critical at themoment) require one more piece of information: Hint text (the text that's shown in the tooltip window)<br></div><div><br></div><div>However, if you implement Gtk side and add linkref or href to TLinkMouseInfo, the patch will be accepted.<br></div><div><br></div></div>thanks,<br></div><div class="gmail_extra">Dmitry</div></div></blockquote></div><div class="gmail_extra"><br></div><div class="gmail_extra">Done: <a href="http://bugs.freepascal.org/view.php?id=30857">http://bugs.freepascal.org/view.php?id=30857</a> .</div><div class="gmail_extra"><br></div><div class="gmail_extra">I have a question regarding SetTextUIStyle for WinVCL, its current implementation is:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">class procedure TRichEditManager.SetTextUIStyle(RichEditWnd: Handle; const ui: TTextUIParam);</div><div class="gmail_extra">var</div><div class="gmail_extra"> w : WPARAM;</div><div class="gmail_extra"> fmt : TCHARFORMAT2;</div><div class="gmail_extra">{ st : TSetTextEx;</div><div class="gmail_extra"> linkrtf : String;</div><div class="gmail_extra"> txt : WideString;</div><div class="gmail_extra"> txtrtf : String;}</div><div class="gmail_extra">begin</div><div class="gmail_extra"> if RichEditWnd = 0 then Exit;</div><div class="gmail_extra"><br></div><div class="gmail_extra"> w := SCF_SELECTION;</div><div class="gmail_extra"><br></div><div class="gmail_extra"> FillChar(fmt, sizeof(fmt), 0);</div><div class="gmail_extra"> fmt.cbSize := sizeof(fmt);</div><div class="gmail_extra"><br></div><div class="gmail_extra"> fmt.dwMask := CFM_LINK;</div><div class="gmail_extra">(* txt := GetTextW(RichEditWnd, true);</div><div class="gmail_extra"> st.codepage:=CP_ACP;</div><div class="gmail_extra"> st.flags:=ST_SELECTION;</div><div class="gmail_extra"> txtrtf:=txt;</div><div class="gmail_extra"> writeln('txtrtf = ', txtrtf);</div><div class="gmail_extra"> linkrtf:=Format('{\rtf1{\field{\*\fldinst{ HYPERLINK "%s"}}{\fldrslt{%s}}}}',</div><div class="gmail_extra"> [ui.linkref, txtrtf]);</div><div class="gmail_extra"> SendMessage(RichEditWnd, EM_SETTEXTEX, WPARAM(@st), LParam(@linkrtf[1])); *)</div><div class="gmail_extra"><br></div><div class="gmail_extra"> if uiLink in ui.features then fmt.dwEffects := fmt.dwEffects or CFE_LINK;</div><div class="gmail_extra"><br></div><div class="gmail_extra"> SendMessage(RichEditWnd, EM_SETCHARFORMAT, w, PtrInt(@fmt));</div><div class="gmail_extra">end;</div></div><div class="gmail_extra"><br></div><div class="gmail_extra">what about to change it to?</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">class procedure TRichEditManager.SetTextUIStyle(RichEditWnd: Handle; const ui: TTextUIParam);</div><div class="gmail_extra">var</div><div class="gmail_extra">{ w : WPARAM;</div><div class="gmail_extra"> fmt : TCHARFORMAT2;}</div><div class="gmail_extra"> st : TSetTextEx;</div><div class="gmail_extra"> linkrtf : String;</div><div class="gmail_extra"> txt : String;</div><div class="gmail_extra">begin</div><div class="gmail_extra"> if RichEditWnd = 0 then Exit;</div><div class="gmail_extra"><br></div><div class="gmail_extra">(* w := SCF_SELECTION;</div><div class="gmail_extra"><br></div><div class="gmail_extra"> FillChar(fmt, sizeof(fmt), 0);</div><div class="gmail_extra"> fmt.cbSize := sizeof(fmt);</div><div class="gmail_extra"><br></div><div class="gmail_extra"> fmt.dwMask := CFM_LINK;*)</div><div class="gmail_extra"><br></div><div class="gmail_extra"> txt := GetTextUtf8(RichEditWnd, true);</div><div class="gmail_extra"> st.codepage:=CP_UTF8;</div><div class="gmail_extra"> st.flags:=ST_SELECTION;</div><div class="gmail_extra"> linkrtf:=Concat('{\rtf1{\field{\*\fldinst{ HYPERLINK "',ui.linkref,'"}}{\fldrslt{ ',txt,' }}}}');</div><div class="gmail_extra"> SendMessage(RichEditWnd, EM_SETTEXTEX, WPARAM(@st), LParam(@linkrtf[1]));</div><div class="gmail_extra"><br></div><div class="gmail_extra">(* if uiLink in ui.features then fmt.dwEffects := fmt.dwEffects or CFE_LINK;</div><div class="gmail_extra"><br></div><div class="gmail_extra"> SendMessage(RichEditWnd, EM_SETCHARFORMAT, w, PtrInt(@fmt));*)</div><div class="gmail_extra">end;</div></div><div class="gmail_extra"><br></div><div class="gmail_extra">I'm not sure about SetTextUIStyle purpose, if it just retrieve links, the implementation above is done, otherwise it needs a small change, if uiLink in ui.features it applies HYPERLINK, else it keeps EM_SETCHARFORMAT as is.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Anyway, it can be the next step implementing (friendly name) hyperlinks support as soon as 30857 was applied.</div><div class="gmail_extra"><br></div><div class="gmail_extra">(I'm going to test some rtfs documents containing hyperlinks generated via RichMemo (current it does not keep hidden URLs), LibreOffice Writer and MS Word ... ).</div><div class="gmail_extra"><br></div>--<br><div class="gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div>
</div></div>