Mega Code Archive

 
Categories / Delphi / VCL
 

How to handling accelerators on the tabs of a TPageControl

Title: How to handling accelerators on the tabs of a TPageControl // in form declaration private procedure CMDialogChar(var Msg: TWMCHAR); message CM_DIALOGCHAR; end; type TPageControlCracker = class(TPageControl); {...} implementation procedure TForm1.CMDialogChar(var Msg: TWMCHAR); var i: Integer; begin if (Msg.keydata and $20000000) 0 then begin { Alt key is down } with TPageControlCracker(PageControl1) do for i := 0 to PageCount - 1 do begin if IsAccel(Msg.charcode, Pages[i].Caption) then begin if CanChange then begin ActivePage := Pages[i]; Msg.Result := 1; Change; Exit; end; { If } end; { If } end; {For} end; {If} inherited; end;