Witam,
mam TWebBrowser (okno czatu), do którego ładowane są wiadomości za pomocą kodu:
// Memo1.Lines - treść wysyłanej wiadomości
RichEditToWB(WebBrowser1, Memo1.Lines);
procedure TfrmRozmowa.RichEditToWB(AWebBrowser: TWebBrowser; AHTMLCode: TStrings);
var
Documentx: OleVariant;
begin
if AWebBrowser.Document = nil then
AWebBrowser.Navigate('about:blank');
Documentx:=AWebBrowser.Document;
Documentx.Write(AHTMLCode.Text);
Documentx.Close;
Application.ProcessMessages;
WB_ScrollTo(WebBrowser1, wbPosBottom);
end;
Mam obsłużone zdarzenie OnBeforeNavigate2:
procedure TfrmRozmowa.WebBrowser1BeforeNavigate2(ASender: TObject;
const pDisp: IDispatch; const URL, Flags, TargetFrameName, PostData,
Headers: OleVariant; var Cancel: WordBool);
var
s: string;
begin
Flag := Flags;
if (Flags = 64) or (Flags = 320) and (IsURL(URL)) then
begin
Cancel := True;
s := StringReplace(URL, 'about:', '', [rfReplaceAll]);
ShellExecute(0, nil, PWideChar(s), nil, nil, SW_SHOW);
end;
end;
Lecz w przypadku, gdy w webbrowserze klikam na link w postaci:
<a href="file:///c:\plik.txt">Tutaj plik</a>
to nic się nie dzieje, a co gorsza - zdarzenie before navigate nie reaguje (break point)
W jaki sposób mogę obsługiwać linki klikane za pomocą kursora?
Wiadomości ładowane są z bazy danych.
dodanie znacznika <code class="html">
- @furious programming