Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 3 of 3 total |
OnCellupdate issue |
Mon, Feb 19 2018 8:19 AM | Permanent Link |
Huseyin Aliz myBiss ApS | Hi All,
I want to change background color and font color for selected row in a grid. I am using following code:    // Check for not active/selected rows:     if (ACell.index mod 2=0) and (SameText(ACell.InterfaceState,NORMAL_STATE_NAME)) and (ACell.Index <> ServiceGrid.RowIndex) then begin     ACell.Font.Size := 12;     ACell.Font.Color := clBlack;     ACell.Background.Fill.Color := clWhite;     end     else if (ACell.Index <> ServiceGrid.RowIndex) and (SameText(ACell.InterfaceState,NORMAL_STATE_NAME)) then     begin     ACell.Font.Size := 12;     ACell.Font.Color := clBlack;     ACell.Background.Fill.Color:=clWhiteSmoke;     end;    // Check for active/selected row and change color:     if (ACell.Index = ServiceGrid.RowIndex) and (SameText(ACell.InterfaceState,BOTH_STATE_NAME)) then begin     ACell.Font.Size := 12;     ACell.Font.Color := clWhite;     ACell.Background.Fill.Color := clRed;     end; It kinda works, it shows correctly for the beginning of the grid, but in the middle or bottom of the grid (scrolling) the font color are ignored - shows in color black, background color red is still ok. Can anyone spot what's going on? Regards, Hüseyin |
Thu, Feb 22 2018 3:54 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Huseyin,
<< It kinda works, it shows correctly for the beginning of the grid, but in the middle or bottom of the grid (scrolling) the font color are ignored - shows in color black, background color red is still ok. Can anyone spot what's going on? >> There are two issues that I can see: 1) If you want to alternate colors via the mod function, you don't want to mod the cell index, you want to mod the row index. 2) When comparing the cell index against the row index, you need to make sure to subtract the RowOffset property from the RowIndex property. Otherwise, you're comparing apples to oranges. Tim Young Elevate Software www.elevatesoft.com |
Thu, Feb 22 2018 6:15 PM | Permanent Link |
Richard Harding Wise Nutrition Coaching | Huseyin
<<< if (ACell.Index = ServiceGrid.RowIndex) and (SameText(ACell.InterfaceState,BOTH_STATE_NAME)) then begin ACell.Font.Size := 12; ACell.Font.Color := clWhite; ACell.Background.Fill.Color := clRed; end; >>> ACell.Index refers to the index of the cell in the grid column. ServiceGrid.RowIndex is index of the current row in the grid control So they are not comparable. It will "work" whilst the number of columns in the grid control is less than the index of the current row in the grid. Richard |
This web page was last updated on Tuesday, December 10, 2024 at 04:57 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |