logosapience
asked on
TForm & focus
Hello,
I have 2 TForm created, one above the other.
What I want to do is to use the VK_LEFT or VK_RIGHT key on the top-most window but the problem is when I press one of these 2 keys, the windows beside the other gets the focus.
How can I do?
I have 2 TForm created, one above the other.
What I want to do is to use the VK_LEFT or VK_RIGHT key on the top-most window but the problem is when I press one of these 2 keys, the windows beside the other gets the focus.
How can I do?
ASKER
new thing :
I put the following procedure on each form :
Procedure CMDialogKey( Var msg: TCMDialogKey );
message CM_DIALOGKEY;
and when I press VK_Left or Right, it's the procedure in the hidden window which is executed...
So, it means that the hidden window always have the focus...
I put a Form2.setfocus on the OnShow event of the topmost window but it's the same.
I put the following procedure on each form :
Procedure CMDialogKey( Var msg: TCMDialogKey );
message CM_DIALOGKEY;
and when I press VK_Left or Right, it's the procedure in the hidden window which is executed...
So, it means that the hidden window always have the focus...
I put a Form2.setfocus on the OnShow event of the topmost window but it's the same.
Have you tried it with a simple OnKeyDown event in the form?
Cheers,
Raymond.
Cheers,
Raymond.
ASKER
Yes I tried but all this happens before the onkeydown event...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, it works, thanks very much!
I assume you are using an OnKeyDown handler in the form? You might like to make sure that KeyPreview property for the forms is set to true...
Cheers,
Raymond.