Problems with TPageControl, TCustomControl descendant and Accelerrators

When I put my own Controls (TCustomControl descendants) on a pagecontrol and type some text in my control (Keypress method is overriden) all works good - till I define key accelerators for the tabsheets. Then even if I don't press the ALT key, the accelerator keys are sent to the pagecontrol and dont reach anymore my control.
This happens here:

procedure TCustomTabControl.CMDialogChar(var Message: TCMDialogChar);
var
  I: Integer;
begin
  for I := 0 to FTabs.Count - 1 do
    if IsAccel(Message.CharCode, FTabs[I]) and CanShowTab(I) and CanFocus then
    begin
      Message.Result := 1;
      if CanChange then
      begin
        TabIndex := I;
        Change;
      end;
      Exit;
    end;
  inherited;
end;

Why is a CM_DialogChar message sent to the pagecontol even if I dont press the ALT key??? What can I do to change that behaviour? (Without editing the VCL code or subclass pagecontrol)
aacrgAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LischkeCommented:
Try capturing the WM_GETDLGCODE in your self made controls and return DLGC_WANTALLKEYS in Message.Result. This should do the job...

Ciao, Mike
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
aacrgAuthor Commented:
I only returned DLGC_WANTARROWS... - I'll test your suggestion.
0
aacrgAuthor Commented:
I must have been blind there was a flag in my component that controlled that behaviour... It's several months ago that I wrote it and it's quite big so I didn't remember that there was a such flag...
Thanks, aacrg.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

aacrgAuthor Commented:
I give you just a "C" because the question wasn't really hard - but I was blind...
0
LischkeCommented:
aacrg, that's not fair. The grade you give is not for how hard the question is (this is expressed by the points you are assigning), but shows how good the provided answer is and how good it solved your problem. I reacted very fast with a proper answer and tried to understand your problem (your's, not mine!) just to earn a C...

Ciao, Mike
0
aacrgAuthor Commented:
That's true but I really hit the false button normally I increase the points afterwards. It's true that you reacted very fast and gave the right answer. So it was perhaps fairer to give you an A.
0
LischkeCommented:
. yes indeed and once you have accepted an answer it doesn't make any difference for you which grade you give, but of course for the one who answered...
0
aacrgAuthor Commented:
That's true but I actually can't change your grading. What can I do to make you happy?
0
LischkeCommented:
:-) nothing specific :-) Just let's close this discussion and I hope next time you think more careful about which grade you give...

Ciao, Mike
0
aacrgAuthor Commented:
Shure.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.