Thanks Dennis. This indeed did the trick for Enter, _but_ now Escape key
functionality disappeared. Escape used to work as a Reset button, now it
does not ...
Regards
Alex Kouznetsov
ALM Systems Ltd
www.almsystems.com
----- Original Message -----
From: "Dennis Chuah" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Friday, 6 July 2001 3:15
Subject: RE: [DUG]: TWebBrowser and Enter key
>
> This is because of the way Delphi handles in place OLE activation. I saw
> this workaround for D4, but haven't tried it for D5. (Assuming
WebBrowserIE
> is the TWebBrowser component).
>
> Regards,
> Dennis.
>
> ---------------------------- code begins -------------------------------
>
> declare the following form variables:
> FOleInPlaceActiveObject: IOleInPlaceActiveObject;
> SaveMessageHandler: TMessageEvent;
>
> procedure TfrmBrowser.FormCreate(Sender: TObject);
> begin
> FOleInPlaceActiveObject := Nil;
> SaveMessageHandler := Nil;
> end;
>
> procedure TfrmBrowser.FormActivate(Sender: TObject);
> begin
> SaveMessageHandler := Application.OnMessage;
> Application.OnMessage := MessageHandler;
> end;
>
> procedure TfrmBrowser.FormDeactivate(Sender: TObject);
> begin
> Application.OnMessage := SaveMessageHandler;
> end;
>
> procedure TfrmBrowser.FormClose(Sender: TObject;
> var Action: TCloseAction);
> begin
> Application.OnMessage := SaveMessageHandler;
> FOleInPlaceActiveObject := Nil;
> end;
>
> procedure TfrmBrowser.MessageHandler (var Msg: TMsg; var Handled:
Boolean);
> var
> iOIPAO: IOleInPlaceActiveObject;
> Dispatch: IDispatch;
> begin
> // Sanity check
> if WebBrowserIE = Nil then begin
> Handled := False;
> Exit;
> end; // if
>
> Handled := IsDialogMessage (WebBrowserIE.Handle, Msg);
>
> if Handled and not WebBrowserIE.Busy then begin
> if FOleInPlaceActiveObject = Nil then begin
> Dispatch := WebBrowserIE.Application;
> if Dispatch <> Nil then begin
> Dispatch.QueryInterface (IOleInPlaceActiveObject, iOIPAO);
> if iOIPAO <> Nil then FOleInPlaceActiveObject := iOIPAO;
> end; // if
> end; // if
>
> if FOleInPlaceActiveObject <> Nil then begin
> with Msg do
> if ((message = WM_KEYDOWN) or (message = WM_KEYUP)) and
> (wParam in [VK_BACK, VK_LEFT, VK_RIGHT]) then
> else
> FOleInPlaceActiveObject.TranslateAccelerator (Msg);
> end; // if
> end; // if
> end;
>
> initialization
> OleInitialize (Nil);
>
> finalization
> OleUninitialize;
>
> end.
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, 6 July 2001 16:44
> > To: Multiple recipients of list delphi
> > Subject: [DUG]: TWebBrowser and Enter key
> >
> >
> > When using TWebBrowser and filling some web page form, pressing Enter
key
> > does not submit data entry.
> >
> > Say I go to www.anzwers.com.au and using IE type 'Delphi' and then press
> > enter. It'll go to search for Delphi.
> >
> > If I do exactly the same thing using the simplest possible Delphi
> > application with TWebBrowser in it, pressing enter key does
> > nothing, I have
> > to click the search (or submit) button with the mouse.
> >
> > All I have in my application is a basic form with TWebBrowser in
> > it and this
> > code under "Go" button (not "default").
> >
> > Flags := 0;
> > WebBrowser1.Navigate(WideString('www.whatever.com'), Flags, Flags,
Flags,
> > Flags);
> >
> > Is there something I am missing ?
> >
> > Regards
> > Alex
> >
> >
> >
> >
> > ------------------------------------------------------------------
> > ---------
> > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> > Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> >
>
> --------------------------------------------------------------------------
-
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"