It definitely works fine for both IE4 and IE5 and Win95 and Win98 ... I
haven't tried it in an MDI window though.
Xander
-----Original Message-----
From: Dennis Chuah <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Wednesday, May 05, 1999 12:24 PM
Subject: RE: [DUG]: WebBrowser Component
>
>Xander,
>
>I tried this but it always seems to return true (for keyboard messages) in
>IsDialogMessage, but does not shift the focus on the TAB key press. I am
>doing this in D3 using IE4. It could be that the IE4 control is in an MDI
>child window - I will try using a non MDI window and a bit more
>experimentation.
>
>Dennis.
>
>> Dave, the following code snippet should do what you want:
>>
>> //----------------------------------------------------------------
>> ----------
>> --------
>> ..
>>
>> var
>> Form1: TForm1;
>> FOleInPlaceActiveObject: IOleInPlaceActiveObject;
>> SaveMessageHandler: TMessageEvent;
>>
>> ...
>>
>> implementation
>> ...
>>
>> procedure TForm1.FormActivate(Sender: TObject);
>> begin
>> SaveMessageHandler := Application.OnMessage;
>> Application.OnMessage := MyMessageHandler;
>> end;
>>
>> procedure TForm1.FormDeactivate(Sender: TObject);
>> begin
>> Application.OnMessage := SaveMessageHandler;
>> end;
>>
>> procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
>> begin
>> Application.OnMessage := SaveMessageHandler;
>> FOleInPlaceActiveObject := nil;
>> end;
>>
>> procedure TForm1.MyMessageHandler(var Msg: TMsg; var Handled: Boolean);
>> var
>> iOIPAO: IOleInPlaceActiveObject;
>> Dispatch: IDispatch;
>> begin
>> { exit if we don't get back a webbrowser object }
>> if WebBrowser = nil then
>> begin
>> Handled := False;
>> Exit;
>> end;
>>
>> Handled:=(IsDialogMessage(WebBrowser.Handle, Msg) = True);
>>
>> if (Handled) and (not WebBrowser.Busy) then
>> begin
>> if FOleInPlaceActiveObject = nil then
>> begin
>> Dispatch := WebBrowser.Application;
>> if Dispatch <> nil then
>> begin
>> Dispatch.QueryInterface(IOleInPlaceActiveObject, iOIPAO);
>> if iOIPAO <> nil then
>> FOleInPlaceActiveObject := iOIPAO;
>> end;
>> end;
>>
>> if FOleInPlaceActiveObject <> nil then
>> if ((Msg.message = WM_KEYDOWN) or (Msg.message = WM_KEYUP)) and
>> (Msg.wParam in [VK_BACK, VK_LEFT, VK_RIGHT]) then
>> //nothing - do not pass on Backspace, Left or Right arrows
>> else
>> FOleInPlaceActiveObject.TranslateAccelerator(Msg);
>> end;
>> end;
>>
>> // need the initialization/finalization to make Cut and Copy work
>> initialization
>> OleInitialize(nil);
>>
>> finalization
>> OleUninitialize;
>> end.
>> //----------------------------------------------------------------
>> ----------
>> --------
>>
>>
>> Hope this helps
>> Xander van der Merwe
>>
>>
>> -----Original Message-----
>> From: Dave O'Brien <[EMAIL PROTECTED]>
>> To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
>> Date: Thursday, April 29, 1999 10:44 AM
>> Subject: [DUG]: WebBrowser Component
>>
>>
>> >I know a few people have asked about this component before, how do I get
>> >the TAB key to move between fields in a form in the WebBrowser activex
>> >component. I've got everything else working fine, and I am trapping the
>> >TAB keypress in the main form, but what do I do with it? I have looked
>> >through the type library but cannot find any method of moving the focus.
>> >
>> >This component has taken a lot of my time over the last six months, and
>> >we are almost ready to launch but for this one problem.
>> >
>> >Any help greatly appreciated.
>> >
>> >Cheers,
>> >David O'Brien.
>> >-----------------------------------------------------------------
>> ----------
>> > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>> > Website: http://www.delphi.org.nz
>>
>> ------------------------------------------------------------------
>> ---------
>> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>> Website: http://www.delphi.org.nz
>>
>
>
>---------------------------------------------------------------------------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz