Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread grid showlines ?
Tue, Apr 25 2017 5:01 PMPermanent Link

kamran

Hi

So on a TGrid,
I have a number of detail  lines from an order I would like to group together visually for each order header

eg.

order # 1 might have 3 lines of data - will want to use showlines border around those 3 lines to group it together visually.
order #2 might have 2 lines of data - will want to use showlines border around those 2 lines to group them together visually.

1. When the grid is set to readonly - showlines do not appear.
2. How to change the default color of showlines
3.How to use showlines  and set a color for it to group together detail lines from the same order.

Is this possible and if so how ?

4. Any other way to achieve the same effect on a grid ?

kind regards

Kamran
Tue, Apr 25 2017 5:51 PMPermanent Link

Uli Becker

I guess you mean "rows" when you say "lines".

> 1. When the grid is set to readonly - showlines do not appear.

The color of a cell's border can be customized in the according
interface (maybe in readonly mode the border color is the same as the
background color).
Look for "TGrid*CellWithLines.wbi" (for each control type there is an
interface, e.g. "TGridTextCellWithLines.wbi")

> 2. How to change the default color of showlines

see the answer above

> 3.How to use showlines  and set a color for it to group together detail lines from the same order.
> Is this possible and if so how ?

No, since the border color is determined by the interface.

> 4. Any other way to achieve the same effect on a grid ?

You could customize a cell's background color and/or font properties
depending on its value. OnCellUpdate is the right event for that:

Sample:

procedure TMyForm.Column1CellUpdate(Sender: TObject; ACell: TGridCell);
begin
   if copy(ACell.data,length(ACell.data)-1) = '  ' then
   begin
      ACell.Font.Color := clBlue;
      ACell.Font.Style.Bold := true;
   end
end;

Uli
Wed, Apr 26 2017 4:05 AMPermanent Link

kamran

Hi Uli

Yes I was referring to the "showlines" property of TGrid and yes when I say lines I meant rows.

Thanks, I will look into all that.

Cheers

Kamran

Uli Becker wrote:

I guess you mean "rows" when you say "lines".

> 1. When the grid is set to readonly - showlines do not appear.

The color of a cell's border can be customized in the according
interface (maybe in readonly mode the border color is the same as the
background color).
Look for "TGrid*CellWithLines.wbi" (for each control type there is an
interface, e.g. "TGridTextCellWithLines.wbi")

> 2. How to change the default color of showlines

see the answer above

> 3.How to use showlines  and set a color for it to group together detail lines from the same order.
> Is this possible and if so how ?

No, since the border color is determined by the interface.

> 4. Any other way to achieve the same effect on a grid ?

You could customize a cell's background color and/or font properties
depending on its value. OnCellUpdate is the right event for that:

Sample:

procedure TMyForm.Column1CellUpdate(Sender: TObject; ACell: TGridCell);
begin
   if copy(ACell.data,length(ACell.data)-1) = '  ' then
   begin
      ACell.Font.Color := clBlue;
      ACell.Font.Style.Bold := true;
   end
end;

Uli
Image