I need a built-in on screen numeric keypad in my Application. For various reasons I cannot use the TMS Software or other commercial component offerings. I\'m very happy with
You can use a TSpeedButton for this task on your Keypad. TSpeedButton does not steel the Focus. But the Form does. And this is ugly, even if you give the focus back to your main form, the focus flickers between the two forms. So I would try to create a form without focus.
A flag named WS_EX_NOACTIVATE can be used to create a window (form) that does not become the foreground window when the user clicks it. Also, the system does not bring this window to the foreground when the user minimizes or closes the foreground window.
To create a non activatable form, override the CreateParams method as:
procedure TMainForm.CreateParams(var Params: TCreateParams) ;
//const WS_EX_NOACTIVATE = $8000000;
begin
inherited;
Params.ExStyle := Params.ExStyle + WS_EX_NOACTIVATE;
end;
When Delphi creates a form, the Create method calls the CreateWindowEx API function to create the actual window.
Before executing the CreateWindowEx, the CreateParams method is called - CreateParams allows you to change the default style of a window when it is created to suit your particular needs.