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

CppwebBrowser and Keys

7 views
Skip to first unread message

Eric B.

unread,
Jun 8, 2002, 7:11:32 PM6/8/02
to
I put a TCppwebBrowser on a form and set the forms KeyPreview to true.
Code below:
Here's what i observe. Some keys are never detected (like the Arrow Keys)
after one key is detected the events never fire again for most keys.
Backspace Home End and PageUp and PgDown are always caught by the
CppWebBrowser
but not by the Form Key events.
Seems like CppwebBrowser is grabbing keys somehow.

Anyone know whats happening here? I would prefer to catch the keystrokes and
then
make calls to appropriate browser functions or whatever.
Thanks
Eric

void __fastcall TForm3::FormKeyDown(TObject *Sender, WORD &Key, TShiftState
Shift)
{
ShowMessage(IntToStr(Key)); // for debug only
}
void __fastcall TForm3::FormKeyPress(TObject *Sender, char &Key)
{
ShowMessage("kp "+IntToStr(Key)); // for debug only
}

--
...
...
...This Post Has Been Tested and is Anthrax Free...
...
...


Hans Galema

unread,
Jun 9, 2002, 4:31:41 AM6/9/02
to
"Eric B." wrote:
>
> I put a TCppwebBrowser on a form and set the forms KeyPreview to true.
> Code below:
> ...

> I would prefer to catch the keystrokes and
> then make calls to appropriate browser functions or whatever.

In general its not a good idea to investigate on events with ShowMessage
as it will generte other events. Better place it in a string or a memo.

Aaron Bockover once showed how to catch all events.

Hans.


// Place in the form's constructor:
Application->OnMessage = IEMessageHandler;

void __fastcall TForm1::IEMessageHandler(tagMSG &Msg, bool &Handled)
{
/*
Subject: Re: TcppWebrowser - Return Key does not work in TextArea object on web
page
Date: Sun, 7 Apr 2002 23:25:58 -0400
From: "Aaron Bockover" <ma...@aaronbock.net>
Newsgroups: borland.public.cppbuilder.internet
*/

// to find out whats going on, place a TMemo
if (Msg.message == WM_KEYDOWN || Msg.message == WM_KEYUP || Msg.message ==
WM_CHAR)
Memo2->Lines->Add ( "IEMessageHandler: " + IntToStr (Msg.message )
+ " " + IntToStr (Msg.wParam ) );


// This code is used to fix the <enter> problem in the IE Control ( for
textarea
if(Msg.message == WM_RBUTTONDOWN || Msg.message == WM_RBUTTONDBLCLK)
{
#define LEAVE_POPUP_MEMU

#if defined LEAVE_POPUP_MEMU
Handled = false;
#else
if(Msg.message == WM_RBUTTONDOWN ) ShowMessage (" WM_RBUTTONDOWN" );
if(Msg.message == WM_RBUTTONDBLCLK ) ShowMessage ("WM_RBUTTONDBLCLK" );

Handled = true;
#endif
}
else if(CppWebBrowser1
&& (Msg.message == WM_KEYDOWN || Msg.message == WM_KEYUP)
&& (Msg.wParam == VK_RETURN || Msg.wParam == VK_EXECUTE)
)
{
Handled = IsDialogMessage(CppWebBrowser1->Handle, &Msg);

if(Handled)
{
if (!OleInPlaceActiveObject)
{
CppWebBrowser1->Application->QueryInterface(
IID_IOleInPlaceActiveObject, (void**)&OleInPlaceActiveObject
);
}

if(OleInPlaceActiveObject)
{
OleInPlaceActiveObject->TranslateAccelerator(&Msg);
}
}
}
else
{
Handled = false;
}
}

Eric B.

unread,
Jun 9, 2002, 11:05:26 AM6/9/02
to
I'll investigate that, BTW what is OleInPlaceActiveObject declared as?
Thanks
Eric

--
...
...
...This Post Has Been Tested and is Anthrax Free...
...
...

"Hans Galema" <j.m.g...@maartens.nl> wrote in message
news:3D03126D...@maartens.nl...

Hans Galema

unread,
Jun 9, 2002, 2:30:49 PM6/9/02
to
"Eric B." wrote:
>
> I'll investigate that, BTW what is OleInPlaceActiveObject declared as?

I don't know.

Hans.

Please don't quote entire messages.

0 new messages