BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: focus of a TWinControl

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
Marc Rohloff
Guest





PostPosted: Tue Nov 04, 2003 12:47 pm    Post subject: Re: focus of a TWinControl Reply with quote



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





PostPosted: Tue Nov 04, 2003 12:51 pm    Post subject: Re: focus of a TWinControl Reply with quote



"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.

Quote:
What to do ?

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.