aacrg
asked on
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.CMDialog Char(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)
This happens here:
procedure TCustomTabControl.CMDialog
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)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
Thanks, aacrg.
ASKER
I give you just a "C" because the question wasn't really hard - but I was blind...
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
Ciao, Mike
ASKER
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.
. 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...
ASKER
That's true but I actually can't change your grading. What can I do to make you happy?
:-) nothing specific :-) Just let's close this discussion and I hope next time you think more careful about which grade you give...
Ciao, Mike
Ciao, Mike
ASKER
Shure.
ASKER