Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 6 of 6 total |
Grid cell background colour |
Mon, Nov 28 2016 5:54 AM | Permanent Link |
Chris Holland SEC Solutions Ltd. Team Elevate | I am trying to colour a cell within a grid to show different status
values. Each row in the data table stores the required colour for that cell. I have added the following code to the CellUpdate function. > procedure TMainForm.StatusColCellUpdate(Sender: TObject; ACell: TGridCell); > begin > if ACell.Index <> HistoryGrid.RowIndex then > ACell.Background.Fill.Color := DataModule.SiteHistoryTable.Columns['StatusColor'].AsInteger; > end; This works okay except for the fact that the cell background colour changes as the mouse cursor moves over it. How do I stop this happening? -- Chris Holland [Team Elevate] |
Mon, Nov 28 2016 1:12 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Chris,
<< This works okay except for the fact that the cell background colour changes as the mouse cursor moves over it. >> Do you mean that the cell background *permanently* changes, or just temporarily ? Tim Young Elevate Software www.elevatesoft.com |
Tue, Nov 29 2016 3:41 AM | Permanent Link |
Chris Holland SEC Solutions Ltd. Team Elevate | It changes permanently i.e. until the row selection bar moves over it again.
Chris Holland [Team Elevate] On 28/11/2016 18:12, Tim Young [Elevate Software] wrote: > Chris, > > << This works okay except for the fact that the cell background colour changes as the mouse cursor moves over it. >> > > Do you mean that the cell background *permanently* changes, or just temporarily ? > > Tim Young > Elevate Software > www.elevatesoft.com > |
Tue, Nov 29 2016 3:24 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Chris,
<< It changes permanently i.e. until the row selection bar moves over it again. >> Okay, you need to code the cell update event handler like this to get the desired effect: procedure TForm1.GridColumn2CellUpdate(Sender: TObject; ACell: TGridCell); begin if SameText(ACell.InterfaceState,NORMAL_STATE_NAME) then begin if ACell.Index <> Grid1.RowIndex then ACell.Background.Fill.Color:=clElevateLightGreen else ACell.RefreshInterface; end; end; Tim Young Elevate Software www.elevatesoft.com |
Thu, Dec 1 2016 7:58 AM | Permanent Link |
Chris Holland SEC Solutions Ltd. Team Elevate | Hi Tim,
That works fine if I want them to all be Green but I am trying to set each row to be a different colour depending upon its "Status". (See attached image) So I did this: procedure TForm1.GridColumn2CellUpdate(Sender: TObject; ACell: TGridCell); begin if SameText(ACell.InterfaceState,NORMAL_STATE_NAME) then begin if ACell.Index <> Grid1.RowIndex then ACell.Background.Fill.Color:=SiteTable.Columns['StatusColor'].AsInteger else ACell.RefreshInterface; end; end; But the colours change as the mouse moves the cursor over each row. (The colour changes to the currently selected database record colour) Chris Holland [Team Elevate] On 29/11/2016 20:24, Tim Young [Elevate Software] wrote: > Chris, > > << It changes permanently i.e. until the row selection bar moves over it again. >> > > Okay, you need to code the cell update event handler like this to get the desired effect: > > procedure TForm1.GridColumn2CellUpdate(Sender: TObject; ACell: TGridCell); > begin > if SameText(ACell.InterfaceState,NORMAL_STATE_NAME) then > begin > if ACell.Index <> Grid1.RowIndex then > ACell.Background.Fill.Color:=clElevateLightGreen > else > ACell.RefreshInterface; > end; > end; > > Tim Young > Elevate Software > www.elevatesoft.com > Attachments: PrtScr capture.jpg |
Thu, Dec 1 2016 4:00 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Chris,
<< That works fine if I want them to all be Green but I am trying to set each row to be a different colour depending upon its "Status". (See attached image) >> Is the "Status" in the actual grid contents ? If so, then you need to use the cell's Data property: http://www.elevatesoft.com/manual?action=viewprop&id=ewb2&comp=TGridCell&prop=Data to determine what the cell's contents are, not the dataset row. This is because the cell updates can occur at various times, completely independent of dataset row changes, etc. It's best to think of the OnCellUpdate event handler as being part of the "paint" process, not the dataset refresh process. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Monday, September 9, 2024 at 03:13 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |