Please help me with the following:
I had a problem with arrows and tab keys in Delphi TActiveForm. Those
keys where ignored by the form. The following solution solves all the
problems, but unfortunately introduces new ones. The following keys are
now ignored: !#$%&*(
The keys @^) and all the rest are still working.
The solution is implemented by overriding the WndProc procedure in a
TActiveForm descendant.
class function TCOMFunctions.OCXKeyEvent(var Message: TMessage):
boolean;
{
in WndProc override of a TActiveForm:;
procedure TMyAcitveForm.WndProc(var Message: TMessage); override;
begin
if not TCOMFunctions.OCXKeyEvent(Message) then
inherited;
end;
}
var
msg: TMsg;
begin
result := true;
case Message.Msg of
WM_GETDLGCODE:
begin
Message.Result := DLGC_WANTTAB or DLGC_WANTARROWS or
DLGC_WANTALLKEYS;
//Message.Result := 0; would handle "!#$%&*(" good but will
ignore the arrows and tabs
end;
WM_KEYDOWN:
begin
if Message.WParam in
[
VK_LEFT,
VK_RIGHT,
VK_UP,
VK_DOWN,
VK_TAB,
VK_HOME,
VK_END,
VK_INSERT
]
then
begin
msg.hwnd := GetFocus;
msg.message := Message.Msg;
Msg.WParam := Message.WParam;
Msg.LParam := Message.LParam;
Msg.time := 0;
Msg.pt := point(0,0);
DispatchMessage(msg);
end;
end
else
result := false;
end;
end;
Thanks, Shachar Nemirovsky.
> Please help me with the following:
Hoi Shachar
First you need to repost your question on the Borland news server to make
everybody see it and possibly answer your question. Further, this news
group do not officially exist, the group to use is
borland.public.delphi.com.activex.writing.
How to post to Delphi newsgroups:
<http://tinyurl.com/8m5nw>
which links to
<http://delphi.wikicities.com/wiki/Delphi_Newsgroups>