To describe this issue, the best would that you would test my application with following usecase:
Application: http://ubuntuone.com/p/nF/
- Open application;
- Click on the ">" captioned button;
- Click on same button again;
- Click on the same button again.
As you can see - URL is correctly detected in first expanding, but in any further is not.
Hope to have fix for this issue with your help :)
Currently I do send WM every time dialog is expanded, but it still does not work ...
Expand / Collapse buttons code snipp:
if (PreviewOpn.Caption = '<') and (Width >= 499) then // if form is expanded
begin
PreviewOpn.Caption := '>';
if CheckWin32Version(6,0) then begin
Constraints.MinWidth := 252; ClientWidth := Round(252 - ((Width - ClientWidth) / 2));
end else begin
Constraints.MinWidth := 248; ClientWidth := Round(248 - ((Width - ClientWidth) / 2));
end;
PopupActionBar1.Items[1].Enabled := False; PopupActionBar1.Items[1].Checked := False;
if (PreviewOpn.Caption = '<') and (Width >= 248) then PreviewOpn.Caption := '>';
end else // else if form is collapsed
begin
SendMessage(RichEdit1.Handle, EM_SETEVENTMASK, 0, EM_GETEVENTMASK or ENM_LINK); //|
SendMessage(RichEdit1.Handle, EM_AUTOURLDETECT, Integer(True), 0);
PreviewOpn.Caption := '<';
if CheckWin32Version(6,0) then begin
Constraints.MinWidth := 252; ClientWidth := Round(510 - ((Width - ClientWidth) / 2));
end else begin
Constraints.MinWidth := 248; ClientWidth := Round(499 - ((Width - ClientWidth) / 2));
end;
PopupActionBar1.Items[1].Enabled := True; PopupActionBar1.Items[1].Checked := True;
if (PreviewOpn.Caption = '>') and (Width >= 499) then PreviewOpn.Caption := '<';
if (FileExists(Edit1.Text)) or (FileExists(Edit2.Text)) or (FileExists(ParamStr(1)))
then RAWInputBtnClick(TabSet1);
end;
vClick(VKPInputBtn); // calls PopuMenu items enabling triggers
for n := 0 to RichEdit1.Lines.Count - 1 do if RichEdit1.Width < Canvas.TextWidth(RichEdit1.Lines[n]) then // enable automatic scroolbar settup
RichEdit1.ScrollBars := ssBoth;
Inside Forms OnCreate Event:
SendMessage(RichEdit1.Handle, EM_SETEVENTMASK, 0, EM_GETEVENTMASK or ENM_LINK); //|
SendMessage(RichEdit1.Handle, EM_AUTOURLDETECT, Integer(True), 0); //|
RichEdit1.Lines[5] := RichEdit1.Lines[5] + ' '; //| resend message for line to fix update issue
As http://msdn.microsoft.com/en-us/library/bb787991%28VS.85%29.aspx documentation states, URL is detected by text modification, which means only way to re-invoke detection is to send some kind of message adding / removing characters, BUT:
URL is detected instantly after key on keyboard isp ressed and only INSIDE line. Possible fix would be pretty nasty and therefore I do not even think to develop code sinpp for this :) Idea: Lopp through all avail characters and, for example, add Char(#10) and then remove Char(#10). Drawback: Imagine what happens on large RTF text inside RichEdit control ...