Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TWebBrowser and Mouse Events

150 views
Skip to first unread message

filippo

unread,
Oct 7, 1999, 3:00:00 AM10/7/99
to
Hello!
I used TWebBrowser (delphi 5), but it hasn't a control on mouse events.
There is a way to add them?... in a simple way...

thanks
Filippo

--
-------------------------------------------------------
Filippo Forlani
web page: http://space.tin.it/arte/fiforlan
e.mail fil...@tin.it


Eban S. Thomas

unread,
Oct 8, 1999, 3:00:00 AM10/8/99
to
override the application message handler and intercept the mousedown
message. For example.


procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage:=AppMessage;
end;


procedure TForm1.Appmessage(var Msg:TMsg; var Handled: Boolean);
begin
Doc:=WebBrowser1.document as IHTMLDocument2;
if (Doc <> nil) then
if Msg.Message = WM_LBUTTONDOWN then
begin
..... do something.....
end;
end;

Eban S. Thomas

unread,
Oct 8, 1999, 3:00:00 AM10/8/99
to
This routine will get the element that was clicked and dump
information about the element to a list box


procedure TForm1.Appmessage(var Msg:TMsg; var Handled: Boolean);
begin

if Msg.Message = WM_LBUTTONDOWN then
begin
Doc:=WebBrowser1.document as IHTMLDocument2;
if (Doc <> nil) then

begin

Element:=Doc.elementFromPoint(loWord(msg.LParam),HiWord(Msg.lParam));
try
ListBox1.Clear;

ListBox1.Items.add('ClassName::'+Element.ClassName);

ListBox1.Items.add('innerHTML::'+Element.innerHTML);

ListBox1.Items.add('innertext::'+Element.innerText);

ListBox1.Items.add('OuterHTML::'+Element.outerHTML);

ListBox1.items.add('OuterText::'+Element.outerText);
except
raise;
end;
end;
end;
end;

On Fri, 08 Oct 1999 19:07:39 GMT, in...@powertier.com (Eban S. Thomas)
wrote:

0 new messages