Главная страница | назад





Article #18825: Preventing changing to a page in a page control

 Question and Answer Database
FAQ3825D.txt :Preventing changing to a page in a page control
Category :VCL
Platform :Win95/NT
Product :Delphi3.x, Delphi4.x,
Question:
How do I prevent a user from tabbing to a specific page in a page control?
Answer:
uses
CommCtrl;
procedure TForm1.PageControl1Changing(Sender: TObject;
var AllowChange: Boolean);
var
Info : TTCHitTestInfo;
Index : Integer;
begin
with Info do begin
GetCursorPos(pt);
pt := PageControl1.ScreenToClient(pt);
flags := TCHT_ONITEM;
end;
Index := TabCtrl_HitTest(PageControl1.Handle,@Info);
AllowChange := Index <> 2; // Or another test that makes sense
end;
12/01/1998 1:40:07 PM

Last Modified: 01-SEP-99