BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TActiveForm and key handling

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Development
View previous topic :: View next topic  
Author Message
Shachar
Guest





PostPosted: Tue May 23, 2006 2:14 pm    Post subject: TActiveForm and key handling Reply with quote



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





PostPosted: Tue May 23, 2006 4:14 pm    Post subject: Re: TActiveForm and key handling Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Development All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.