[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Custom edit control

Posted on 1999-12-16
7
Medium Priority
?
414 Views
Last Modified: 2011-09-20
Im trying to create a custom edit control in Delphi 4. I have derived my new control from TCustomControl and i have a WM_KEYDOWN and a WM_CHAR message attach to my control. The problem is that i receive a message for all keys except from the Tab-key and the 4 caret navigation keys. How can i correct that in order to receive a message for those 5 keys as well.
0
Comment
Question by:ON031699
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 1

Expert Comment

by:nrico
ID: 2286612
Use OnKeyDown instead of OnKeyPress.
0
 
LVL 1

Expert Comment

by:nrico
ID: 2286618
Oops... should have read the question better... :-)
0
 
LVL 2

Expert Comment

by:lortega
ID: 2286690
I'm not sure but maybe WM_KEYUP and WM_KEYDOWN will help you...

why don't derivate your component from TCustomEdit instead of TCustomControl?

good luck,
luis
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
LVL 10

Accepted Solution

by:
Lischke earned 300 total points
ID: 2286957
The reason why you don't get those keys is that you excplicitly have to tell that you want them:

type
  TMyControl = class(TCustomControl)
  private
    procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
  end;
procedure TMyControl.WMGetDlgCode(var Message: TWMGetDlgCode);

begin
  Message.Result := DLGC_WANTCHARS or DLGC_WANTARROWS or DLGC_WANTTAB;
end;


Ciao, Mike
0
 
LVL 1

Author Comment

by:ON031699
ID: 2287524
Its working.....
Thanks for the help Lischke.
:)
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2288274
You are welcome...

Ciao, Mike

PS. Why did you give me only a B grading? Wasn't my answer perfect?
0
 
LVL 1

Author Comment

by:ON031699
ID: 2290273
I give a B grading if my question is answered. I will give an A grading if my question is answered and add some additional to the solution. I think there should be some room for the really good answers.
Hope you understand..... :)

Regards
ON
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
Suggested Courses

607 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