 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Shachar Guest
|
Posted: Tue May 23, 2006 2:14 pm Post subject: TActiveForm and key handling |
|
|
Hallo,
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. |
|
| Back to top |
|
 |
Riki Wiki Guest
|
Posted: Tue May 23, 2006 4:14 pm Post subject: Re: TActiveForm and key handling |
|
|
On 23 May 2006 06:26:44 -0700, Shachar wrote:
| Quote: | 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> |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|