Discussion:
TForm.OnKeyDown
(too old to reply)
Hubert Anemaat
2007-11-13 17:23:59 UTC
Permalink
Hello,

In some, not all, of my applications compiled in Delphi 2007, the
TForm.OnKeyDown procedures do not work. In Delphi 6 I have no problem.
In all forms the TForm.KeyPreview is set to True.
Is there another setting in Delphi 2007 to activate the OnKey procedures ?

Thanks,

Hubert Anemaat
Liz
2007-11-13 17:06:49 UTC
Permalink
Post by Hubert Anemaat
In some, not all, of my applications compiled in Delphi 2007, the
TForm.OnKeyDown procedures do not work. In Delphi 6 I have no
problem. In all forms the TForm.KeyPreview is set to True. Is there
another setting in Delphi 2007 to activate the OnKey procedures ?
Cant say Ive noticed any problems - got any examples?
--
Liz the Brit
Delphi things I have released: http://www.xcalibur.co.uk/DelphiThings
Peter Below (TeamB)
2007-11-13 18:22:18 UTC
Permalink
Post by Hubert Anemaat
Hello,
In some, not all, of my applications compiled in Delphi 2007, the
TForm.OnKeyDown procedures do not work. In Delphi 6 I have no
problem. In all forms the TForm.KeyPreview is set to True. Is there
another setting in Delphi 2007 to activate the OnKey procedures ?
Have you verified that the event handler is actually assigned to the
event in the OI? There have been some reports that the assignments can
get lost when you move a project to the newer Delphi version. Has not
happened in any of my projects, though.
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
Hubert Anemaat
2007-11-14 12:51:28 UTC
Permalink
Hello Peter,

It is very strange. The first window in my applications is a database
selector window. This window is used in all applications in a project.
The Esc button in this window closes this window and selects the default
database.
In 4 applications the button Esc works and in 2 applications this button
does not work. In these 2 applications the keyboard key procedures are
not fired in any window.
This is why I think it is somehow an application wide option in Delphi 2007.

Hubert Anemaat
Post by Peter Below (TeamB)
Post by Hubert Anemaat
Hello,
In some, not all, of my applications compiled in Delphi 2007, the
TForm.OnKeyDown procedures do not work. In Delphi 6 I have no
problem. In all forms the TForm.KeyPreview is set to True. Is there
another setting in Delphi 2007 to activate the OnKey procedures ?
Have you verified that the event handler is actually assigned to the
event in the OI? There have been some reports that the assignments can
get lost when you move a project to the newer Delphi version. Has not
happened in any of my projects, though.
Hubert Anemaat
2007-11-14 13:15:39 UTC
Permalink
Hello,

I discovered the problem.
I make use of inherited forms. The parent form TMyStdForm is derived
from TForm and is a part of one of my packages.
In some of my applications this unit is not mentioned in the uses list
of the .dpr. In that case the key procedures are not fired in the
application. The source file .pas of TMyStdForm is not in the source
path of the project. Only the compiled unit .dcu is in the library path.

It is strange that the behaviour of an application depends on the fact
that a unit is mentioned in the unit list or not. This was not the case
in Delphi 6.

Hubert Anemaat
Post by Hubert Anemaat
Hello,
In some, not all, of my applications compiled in Delphi 2007, the
TForm.OnKeyDown procedures do not work. In Delphi 6 I have no problem.
In all forms the TForm.KeyPreview is set to True.
Is there another setting in Delphi 2007 to activate the OnKey procedures ?
Thanks,
Hubert Anemaat
Peter Below (TeamB)
2007-11-14 18:11:59 UTC
Permalink
Post by Hubert Anemaat
Hello,
I discovered the problem.
I make use of inherited forms. The parent form TMyStdForm is derived
from TForm and is a part of one of my packages. In some of my
applications this unit is not mentioned in the uses list of the .dpr.
In that case the key procedures are not fired in the application. The
source file .pas of TMyStdForm is not in the source path of the
project. Only the compiled unit .dcu is in the library path.
It is strange that the behaviour of an application depends on the
fact that a unit is mentioned in the unit list or not. This was not
the case in Delphi 6.
Hm, but if the ancestor form is not part of the project you should get
errors from the IDE when you try to open a derived form, that happend
in every version of Delphi that supported visual form inheritance I can
remember. The IDE needs the ancestor forms DFM file.
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
Hubert Anemaat
2007-11-15 09:08:48 UTC
Permalink
Hello Peter,

That is true. When compiling the dcu files of the packages are written
in the .\dcu110 folder. This .\dcu110 folder is mentioned in the library
path. I have to copy the .dfm files manually to this folder to avoid IDE
errors.
If I do not separate the .dcu and the .dfm files from the source folder,
Delphi is compiling the source of the packages too when a project is
compiled.

Hubert Anemaat
Post by Peter Below (TeamB)
Post by Hubert Anemaat
Hello,
I discovered the problem.
I make use of inherited forms. The parent form TMyStdForm is derived
from TForm and is a part of one of my packages. In some of my
applications this unit is not mentioned in the uses list of the .dpr.
In that case the key procedures are not fired in the application. The
source file .pas of TMyStdForm is not in the source path of the
project. Only the compiled unit .dcu is in the library path.
It is strange that the behaviour of an application depends on the
fact that a unit is mentioned in the unit list or not. This was not
the case in Delphi 6.
Hm, but if the ancestor form is not part of the project you should get
errors from the IDE when you try to open a derived form, that happend
in every version of Delphi that supported visual form inheritance I can
remember. The IDE needs the ancestor forms DFM file.
Loading...