Link to home
Start Free TrialLog in
Avatar of Zoly
Zoly

asked on

Focus change with TCustomControl

Hi,

I have a problem with a set of visual components I'm developing. I'm sure it's something basic, but I'm pretty new to component design so please humor me if I'm asking something really stupid.

My controls are all descendants of TCustomControl and for the most part they work perfectly, with one little exception. They don't receive focus when I press the TAB key. The TabStop value is true, everything (as far as I know) is set up correctly but still, they just don't receive focus with the TAB key. (Clicking on them with the mouse does work, of course.)

Please help.

Z
ASKER CERTIFIED SOLUTION
Avatar of TOndrej
TOndrej

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TOndrej
TOndrej

I forgot to change the declaration of TabStop property default value (which is advisable if you set your defaults in the constructor differently than the ancestor does):

type
  TTestControl = class(TCustomControl)
  ...
    property TabStop default True;
  end;
Avatar of Zoly

ASKER

Thanks! I handled every single message from WM_SETFOCUS to WM_DIALOGCHAR but it never occured to me to catch CM_ENTER and EXIT. :)

Z