TRzPageControl Tab Colors.

Components on the Raize Panels palette: panels, group bars, page controls, splitters, toolbars, status bars, group boxes, etc.

TRzPageControl Tab Colors.

Postby SteveG » Sun Oct 15, 2017 4:39 pm

Hi Ray,

I've never been able to work out how to set the individual colors of tabs. When I read the help in RAD Studio XE7 today (which rarely works), I read this in the section about UseColoredTabs:

The UseColoredTabs property determines whether the color of each tab is derived from the color value for each tab (in the tabs information) or from the color of the control. The default value is False. When False, the color of the tabs will be based on the current Color of the control (which can in turn be determined by the ParentColor value). When True, each tabs color will be the color specified in the tabs information entered via the Edit Tabs editor (accessed via the context menu).

I've never seen the Edit Tabs editor and it certainly doesn't appear in the context menu for me. This probably explains why I've never been able to set the colors.

I have been using XE7 for years, first on one computer and then on a new computer. I wouldn't think it would be an installation problem as I had to newly install Delphi on the new computer and all of the components I use. The Edit Tabs editor has never appeared on either computer.

RAD Studio XE7 Professional
Raize Components Version 6.1.10.

Regards,

Steve
SteveG
 
Posts: 31
Joined:
Wed Aug 10, 2011 11:41 pm
Location: Canberra, Australia

Re: TRzPageControl Tab Colors.

Postby Raize Support » Sun Oct 15, 2017 11:25 pm

Hi Steve,

I understand the confusion. The TRzPageControl is related to the TRzTabControl and both components share a common architecture and features. However, for colored tabs, setting the colors for each tab are handled differently between the two controls. But let me also add some clarification to what happens when UseColoredTabs is set to False (the default).

When UseColoredTabs is False, each tab is painted using the colors specified in the TabColors property. When UseColoredTabs is True, then the tabs in a TRzTabControl are painted using the Color defined in the Tabs collection for the control. Tabs in a TRzPageControl are painted using the Color of the TabSheet.

Therefore, using different colors for tabs in a TRzPageControl is actually quite simple. First, set the UseColoredTabs property for the TRzPageControl to True. Then for each TRzTabSheet that you add to the TRzPageControl, set the tabsheet's Color property.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 611
Joined:
Fri Mar 25, 2011 9:04 pm

Re: TRzPageControl Tab Colors.

Postby SteveG » Sun Oct 15, 2017 11:57 pm

Hi Ray,

Raize Support wrote:Hi Steve,

I understand the confusion. The TRzPageControl is related to the TRzTabControl and both components share a common architecture and features. However, for colored tabs, setting the colors for each tab are handled differently between the two controls. But let me also add some clarification to what happens when UseColoredTabs is set to False (the default).

When UseColoredTabs is False, each tab is painted using the colors specified in the TabColors property. When UseColoredTabs is True, then the tabs in a TRzTabControl are painted using the Color defined in the Tabs collection for the control. Tabs in a TRzPageControl are painted using the Color of the TabSheet.

Therefore, using different colors for tabs in a TRzPageControl is actually quite simple. First, set the UseColoredTabs property for the TRzPageControl to True. Then for each TRzTabSheet that you add to the TRzPageControl, set the tabsheet's Color property.

Ray


Ahh, ok. Thanks for that.

It would be nice if at all possible (some time in the future) to be able to set the color of the tabs themselves for the TRzPageControl rather than the whole page.

BTW, I have been using the Konopka Signature VCL Controls in their Raize Components incarnation for years now in all of my projects. They're still the best around!

Regards,

Steve
SteveG
 
Posts: 31
Joined:
Wed Aug 10, 2011 11:41 pm
Location: Canberra, Australia

Re: TRzPageControl Tab Colors.

Postby Raize Support » Mon Oct 16, 2017 12:23 am

Hi Steve,

You can use the OnPaintTabBackground event to colorize just the tabs yourself. The following sample event handler shows how.

Code: Select all
procedure TForm8.RzPageControl1PaintTabBackground(Sender: TObject; ACanvas: TCanvas; ATabIndex: Integer;
  const ARect: TRect; var Handled: Boolean);
begin
  case ATabIndex of
    0: ACanvas.Brush.Color := clLime;
    1: ACanvas.Brush.Color := clYellow;
    2: ACanvas.Brush.Color := clRed;
  end;
  ACanvas.FillRect( ARect );
  Handled := True;
end;


Thanks for your feedback regarding the components, I appreciate that!

Ray

SteveG wrote:It would be nice if at all possible (some time in the future) to be able to set the color of the tabs themselves for the TRzPageControl rather than the whole page.

BTW, I have been using the Konopka Signature VCL Controls in their Raize Components incarnation for years now in all of my projects. They're still the best around!

Regards,

Steve
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 611
Joined:
Fri Mar 25, 2011 9:04 pm

Re: TRzPageControl Tab Colors.

Postby SteveG » Mon Oct 16, 2017 2:13 am

Raize Support wrote:Hi Steve,

You can use the OnPaintTabBackground event to colorize just the tabs yourself. The following sample event handler shows how.

Code: Select all
procedure TForm8.RzPageControl1PaintTabBackground(Sender: TObject; ACanvas: TCanvas; ATabIndex: Integer;
  const ARect: TRect; var Handled: Boolean);
begin
  case ATabIndex of
    0: ACanvas.Brush.Color := clLime;
    1: ACanvas.Brush.Color := clYellow;
    2: ACanvas.Brush.Color := clRed;
  end;
  ACanvas.FillRect( ARect );
  Handled := True;
end;


Thanks for your feedback regarding the components, I appreciate that!

Ray


Awesome, thanks Ray!

Regards,

Steve
SteveG
 
Posts: 31
Joined:
Wed Aug 10, 2011 11:41 pm
Location: Canberra, Australia

Re: TRzPageControl Tab Colors.

Postby sarahah » Fri Oct 27, 2017 5:32 am

Raize Support wrote:Hi Steve,
Code: Select all
procedure TForm8.RzPageControl1PaintTabBackground(Sender: TObject; ACanvas: TCanvas; ATabIndex: Integer;
  const ARect: TRect; var Handled: Boolean);
begin
  case ATabIndex of
    0: ACanvas.Brush.Color := clLime;
    1: ACanvas.Brush.Color := clYellow;
    2: ACanvas.Brush.Color := clRed;
  end;
  ACanvas.FillRect( ARect );
  Handled := True;
end;


This is helpful to me. Thanks.. :)
sarahah
 
Posts: 1
Joined:
Fri Oct 06, 2017 7:25 am


Return to Panels

Who is online

Users browsing this forum: No registered users and 1 guest

cron