On Thu, Nov 3, 2016 at 4:48 PM, Dmitry Boyarintsev via Lazarus < [email protected]> wrote:
> On Thu, Nov 3, 2016 at 3:36 PM, silvioprog via Lazarus < > [email protected]> wrote: > >> There's ALinkRef parameter, that serves this particular purpose. >>> >> Naturally, LinkRef should end up in TLinkMouseInfo . >>> >> >> Perfect. >> > Now, I take that back. > "ref" information might need to go to some other, rather than > TLinkMouseInfo. > Instead, TLinkMouseInfo should contain information about the cursor (x,y, > shift state, etc) > An extra parameter could be added that would contain LinkInformation > Do you mean about declaring an additional parameter something like this?: RichMemo1LinkAction(Sender: TObject; ALinkAction: TLinkAction; AMouseInfo: TLinkMouseInfo; *ATextInfo: TLinkTextInfo*; ALinkStart, ALinkLen: Integer); If so, it seems a great idea, and the issue #30857 needs some additional patches. :-) I have a question regarding SetTextUIStyle for WinVCL, >> > Why WinVCL? :) > Nothing special, just because some commented code there hehe... xD But what is the main purpose about SetTextUIStyle, it retrieves only links, or links and formatted texts? :-) what about to change it to? >> >> txt := GetTextUtf8(RichEditWnd, true); >> st.codepage:=CP_UTF8; >> st.flags:=ST_SELECTION; >> linkrtf:=Concat('{\rtf1{\field{\*\fldinst{ HYPERLINK >> "',ui.linkref,'"}}{\fldrslt{ ',txt,' }}}}'); >> SendMessage(RichEditWnd, EM_SETTEXTEX, WPARAM(@st), >> LParam(@linkrtf[1])); >> > > That's fine. You just need to make sure that parameters are RTF escaped. > Indeed. We need to fix that. Also, newer versions of RichEdit do provide API for Link management without > need of going into raw RTF. > > But that's why TRichEditManager class is there (even through there's only > one implementation available) > Yes. But I have an idea, we should keep Get/SetTextUIStyle and Get/SetLink supporting only raw links (as implemented above) because it is supported in mostly of richedit versions, but in future versions we should add two new Get/SetURL methods, available only on supported richedit APIs and providing all URL features. (see MS post talking about a SetURL method <https://blogs.msdn.microsoft.com/murrays/2009/09/24/richedit-friendly-name-hyperlinks/> (ITextRange::SetURL), so we can follow the same concept :-) ) -- Silvio Clécio
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus-ide.org/listinfo/lazarus
