Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Grid Column Color
Thu, Jul 9 2015 6:15 PMPermanent Link

Walter Matte

Tactical Business Corporation


Has anyone else tried modifying the grid source to add the Background property for GridColumns.

I have got it working 99%.

But in the one case it fails: if you click in the column but beyond the last row and then move the mouse to the right or left it the grid background (meaning the column color being used is transparent) appears and my "red" never comes back.

Do I have to override an interface or a mouse leave event?

If I move any where else and even the space beyond and back up the column it works fine.

Walter



Attachments: EWB2ColColor.png
Fri, Jul 10 2015 3:18 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Walter,

<< Has anyone else tried modifying the grid source to add the Background
property for GridColumns. >>

I would hold off for now - 2.01 will have a new grid cell update event that
you can use to update the look of one or more cells for a given column.  It
works like this:

procedure TForm1.GridColumn5CellUpdate(Sender: TObject; ACell: TGridCell);
begin
  if SameText(ACell.InterfaceState,NORMAL_STATE_NAME) then
     begin
     if SameText(ACell.Data,'110') then
        begin
        ACell.Font.Color:=clWhite;
        ACell.Background.Fill.Color:=clElevateRed;
        end
     else if SameText(ACell.Data,'144') then
        begin
        ACell.Font.Color:=clWhite;
        ACell.Background.Fill.Color:=clElevateOrange;
        end
     else if SameText(ACell.Data,'44') then
        begin
        ACell.Font.Color:=clWhite;
        ACell.Background.Fill.Color:=clElevateGreen;
        end
     else
        ACell.RefreshInterface;
     end;
end;

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Jul 15 2015 6:13 AMPermanent Link

Walter Matte

Tactical Business Corporation

Is what I am trying to do even possible?

I look forward to the Grid Cell level control, I trust there will still be a Grid Column level properties like color.

Walter
Wed, Jul 15 2015 3:24 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Walter,

<< I look forward to the Grid Cell level control, I trust there will still
be a Grid Column level properties like color. >>

No, you'll have to specify the color for the cells in an OnCellUpdate event
handler.  However, the OnCellUpdate event is a TGridColumn event property,
so you don't have to filter which column you're coloring.

The reason for this is:

a) The grid columns can be enabled/disabled and made read-only, all of which
change the interface state and, subsequently the background color/opacity.

b) The OnCellUpdate event handler may have to do some interface state
comparisons to determine whether or not to color the cell.  For example, you
may not want to color the cell when it's "selected".

As for a), I've been trying to come up with a solution to being able to save
the "modified normal state" of any given control/UI element, but they all
involve making a copy of the entire control/element's UI properties, and I'm
trying to avoid that at all costs.  If you look at a control like a grid,
the number of copies of UI properties could get significant.

Tim Young
Elevate Software
www.elevatesoft.com
Image