i tried to use the enable option of the tab, but with no success result.
tks.
Fabiano
You can hide the tab altogether by setting TabVisible := FALSE. I
don't know if it's possible to disable a tab while keeping it visible;
I've never seen this done anywhere.
-Craig
--
Craig Stuntz Vertex Systems Corporation
Senior Developer http://www.vertexsoftware.com
Delphi/InterBase weblog: http://delphi.weblogs.com
The standard pagecontrol only allows you to hide a tab (Tabvisible =
false), you can disable a tabsheet but the tab is not part of the
tabsheet, it is part of the pagecontrol, so it is still enabled.
If you go to http://www.deja.com, http://www.mers.com/searchsite.html or
http://www.tamaracka.com/search.htm and search the newsgroups for
PBPagecontrol you will find a simple pagecontrol derivative that handles
disabled tabsheets correctly.
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Cheers.................Tony
// Modified procedure
procedure TPBPageControl.DrawTab(TabIndex: Integer; const Rect: TRect;
Active: Boolean);
var
imageindex: Integer;
r, tmpRect: TRect; // tmpRect added
S: String;
begin
If Active then begin
Canvas.Font.Style := [fsBold];
end;
If Assigned( OnDrawTab ) then begin
inherited
end
Else Begin
r:= Rect;
Canvas.Fillrect( r );
imageindex := GetImageIndex( tabindex );
If (imageindex >=0) and Assigned( Images ) Then Begin
SaveDC( canvas.handle );
images.Draw( Canvas, Rect.Left+4, Rect.Top+2,
imageindex,
Pages[TabIndex].enabled );
// images.draw fouls the canvas colors if it draws
// the image disabled, thus the SaveDC/RestoreDC
RestoreDC( canvas.handle, -1 );
R.Left := R.Left + images.Width + 4;
End;
// print caption
S:= Pages[ TabIndex ].Caption;
InflateRect( r, -2, -2 );
// if tab disabled then display text disabled THIS IS THE CHANGED SECTION
// TmpRect added in var section
if not Pages[TabIndex].Enabled then begin
Canvas.Brush.Style := bsClear;
TmpRect := R;
OffsetRect( TmpRect, 1, 1 );
Canvas.Font.Color := clWhite; // shadow
DrawText(Canvas.Handle, PChar(S), Length(S), TmpRect,
DT_SINGLELINE or DT_LEFT or DT_TOP);
OffsetRect( TmpRect, -1, -1);
Canvas.Font.Color := clGray; // main
DrawText(Canvas.Handle, PChar(S), Length(S), TmpRect,
DT_SINGLELINE or DT_LEFT or DT_TOP);
end
else begin // draw text normally
DrawText( Canvas.Handle, PChar(S), Length(S), r,
DT_SINGLELINE or DT_LEFT or DT_TOP );
end;
End;
end;