Tom,

Here is a snippet that changes the color and style of the tab Caption to 
Bole Red when the grid on the tab is not empty.  It implements the 
OnDrawTab event of the TTabControl.  I imagine that you can put in a 
function that determines whether there is an error on the page.  Maybe a 
similar approach would let you change the color of the tab, but I never 
took it that far.

HTH

Walter

procedure TfrmEdChartTest.PageControl1DrawTab(Control: TCustomTabControl;
   TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
   vCaption: string;
begin
   vCaption := (Control as TPageControl).Pages[TabIndex].Caption;
   with Control.Canvas, Font do begin
     FillRect(Rect);
     if (vCaption = 'Filters')
     and not dbgFilters.DataSource.DataSet.IsEmpty then begin  // 
Substitute you own condition here
       Color := clRed;
       Style := Style + [fsBold];
     end
     else begin
       Color := clMenuText;
       Style := Style - [fsBold];
     end;
   end; {with}
   Control.Canvas.TextOut(Rect.Left + 4, Rect.Top + 4,
       {IntToStr(TabIndex) + ' ' +} vCaption);
end;

At 05:30 PM 8/8/2006, you wrote:
>Hello!
>
>I have an application that is entering data into a Grid which is
>controlled by a TabControl.  When the user clicks on the tab, the
>matching grid column is brought to focus.  This works well.  But I would
>like to highlight individual tabs which have errors by changing the Tab
>color of the Tab.  If I can't do this, I would like to change the Font
>Color of the Tab.
>
>Does anyone know how to access this property?  if not, is there a Tab
>control which does?
>
>Thanks for your input!
>
>Tom Nesler
>Live long!...   Code Well!...   and Prosper!...   V
>_______________________________________________
>Delphi mailing list -> [email protected]
>http://www.elists.org/mailman/listinfo/delphi

/*
C. Walter Ogston
Kalamazoo, MI
*/

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to