Solved

Change VK_Left press key action into my VCL

Posted on 2004-04-21
3
795 Views
Last Modified: 2008-03-03
I have a VCL derived from TCutomControl. When I press VK_UP, VK_Down, VL_Left or VK_Right the result is that my VCL change his focus and jump to next control. What to do to use these keys into my VCL and not to change the focus? I have tried untill now into keypress but no result.
0
Comment
Question by:ginsonic
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
shaneholmes earned 500 total points
ID: 10885502
You need to handle the wm_GetDlgCode message as shown below:

TMyCustomControl = class(TCustomControl)
private
 { Private declarations }
 procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
 end;


procedure TMyCustomControl.WMGetDlgCode( var Msg: TWMGetDlgCode );
begin
  inherited;
  Msg.Result := dlgc_WantArrows;   // Control will handle arrow keys
end;


You need to ensure that your control can receive the focus. Descending
from TCustomControl is the first step, which you've done. The next step is
publishing the TabStop & TabOrder properties, so users can navigate to your control
with the keyboard. The third step is calling SetFocus in the MouseDown
method.

Just add the TabStop- and TabOrder-property to the published section
of your control and in the constructor you assign true to the
TabStop-property.


Shane
0
 
LVL 9

Author Comment

by:ginsonic
ID: 10889066
Thanks for support! Work now :)
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10889096
<SMILE>
Your Welcome!

Shane
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now