 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Marc Rohloff Guest
|
Posted: Tue Nov 04, 2003 12:47 pm Post subject: Re: focus of a TWinControl |
|
|
On Tue, 4 Nov 2003 10:17:23 +0100, Steffen
Klössel<steffen.kloessel (AT) gmx (DOT) de> said ...
| Quote: | Currently I write my first component that should receive key-press-events
(not the my first component in generel).
My problem is, that this component (an direct descendend of TCustomControl)
does not receive any key-press-message from the system, unless i set the
focus to the component explitcitly (with MyComponent.SetFocus).
The component does not get the focus by clicking on it.
|
Can you show us the code for your component?
Marc
|
|
| Back to top |
|
 |
Kurt Barthelmess Guest
|
Posted: Tue Nov 04, 2003 12:51 pm Post subject: Re: focus of a TWinControl |
|
|
"Steffen Klössel" <steffen.kloessel (AT) gmx (DOT) de> wrote:
| Quote: | My problem is, that this component (an direct descendend of TCustomControl)
does not receive any key-press-message from the system, unless i set the
focus to the component explitcitly (with MyComponent.SetFocus).
|
Unless the component has the focus, it will never get key messages, of
course.
| Quote: | The component does not get the focus by clicking on it.
|
Correct. No where in Windows or the VCL do they actually do that for
you. You would think it was perfectly obvious that it would be
automatic.
Give your component a WMLButtonDown (right and middle buttons too if
desired) method and in there write:
inherited;
SetFocus;
Good luck.
Kurt
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|