![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 8 of 8 total |
![]() |
Thu, Mar 14 2019 6:07 AM | Permanent Link |
Huseyin Aliz myBiss ApS | Hi All,
I am using different datasets for same grid, and for this i am removing and adding columns when needed, following are my adding method: AGrid.DataSet := ADataSet;  for i := 0 to ADataSet.ColumnCount -1 do begin   col := AGrid.NewColumn;   col.DataColumn := ADataSet.columns[i].Name;   col.Header.Caption := ADataSet.columns[i].Name;   col.Font.Name := 'Arial';   col.Font.Size := 14;   col.Font.Color := clBlack;  end; I want to color every second row with different colour and it works when column are static defined and i am using oncellupdate for his purpose. Now when adding runtime columns i cannot make oncellupdate to happen. This is a method i try with (GridColumnxCellUpdate should allways work as it starts with 0?) procedure TmyForm.GridColumn0CellUpdate(Sender: TObject; ACell: TGridCell); begin SetUpCells(ACell); end; And SetUpCells procedure: procedure TmyForm.SetupCells(ACell: TGridCell); begin     if (ACell.index mod 2=0) and (SameText(ACell.InterfaceState,NORMAL_STATE_NAME)) and (ACell.Index <>   RapportGrid.RowIndex) then begin     ACell.Font.Size := 14;     ACell.Font.Color := clBlack;     ACell.Background.Fill.Color := clWhite;     end     else if (ACell.Index <> RapportGrid.RowIndex) and (SameText(ACell.InterfaceState,NORMAL_STATE_NAME)) then     begin     ACell.Font.Size := 14;     ACell.Font.Color := clBlack;     ACell.Background.Fill.Color:=clWhiteSmoke;     end;     if (ACell.Index = RapportGrid.RowIndex) and (SameText(ACell.InterfaceState,BOTH_STATE_NAME)) then begin     ACell.Font.Size := 14;     ACell.Font.Color := clWhite;     ACell.Background.Fill.Color := clRed;     end; end; Am I missing something here, maybe some kind of event assigning somewhere? Sorry for the long post, and thanks in advance. Huseyin |
Thu, Mar 21 2019 11:36 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Huseyin,
<< I am using different datasets for same grid, and for this i am removing and adding columns when needed, following are my adding method: I want to color every second row with different colour and it works when column are static defined and i am using oncellupdate for his purpose. Now when adding runtime columns i cannot make oncellupdate to happen. >> Are you assigning the event handler to each grid column's OnCellUpdate event property ? https://www.elevatesoft.com/manual?action=viewevent&id=ewb2&comp=TGridColumn&event=OnCellUpdate Tim Young Elevate Software www.elevatesoft.com |
Thu, Mar 21 2019 12:07 PM | Permanent Link |
Huseyin Aliz myBiss ApS | Tim,
I usually know what the grid contains of dataset and datacolumns and use oncellupdate in every column to do the task. In this case the grid columns are dynamically populated from 2 different datasets with different fields ![]() Regards, Huseyin Den 21-03-2019 kl. 16:36 skrev Tim Young [Elevate Software]: > Huseyin, > > << I am using different datasets for same grid, and for this i am removing and adding columns when needed, following are my adding method: > > I want to color every second row with different colour and it works when column are static defined and i am using oncellupdate for his purpose. Now when adding runtime columns i cannot make oncellupdate to happen. >> > > Are you assigning the event handler to each grid column's OnCellUpdate event property ? > > https://www.elevatesoft.com/manual?action=viewevent&id=ewb2&comp=TGridColumn&event=OnCellUpdate > > Tim Young > Elevate Software > www.elevatesoft.com > |
Thu, Mar 21 2019 12:57 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Huseyin,
<< I usually know what the grid contains of dataset and datacolumns and use oncellupdate in every column to do the task. In this case the grid columns are dynamically populated from 2 different datasets with different fields ![]() That's fine, but are you setting the OnCellUpdate event handler ? Without doing that, the event handler won't get triggered for a given grid column. Tim Young Elevate Software www.elevatesoft.com |
Thu, Mar 21 2019 1:04 PM | Permanent Link |
Walter Matte Tactical Business Corporation | Grid.DataSet := ADataSet; for i := 0 to ADataSet.ColumnCount -1 do begin col := AGrid.NewColumn; col.DataColumn := ADataSet.columns[i].Name; col.Header.Caption := ADataSet.columns[i].Name; col.Font.Name := 'Arial'; col.Font.Size := 14; col.Font.Color := clBlack; col.OnCellUpdate := MyCellUpdate; // <<<<<<<<<<<<<<<<<<<<<<<<<< end; |
Thu, Mar 21 2019 4:23 PM | Permanent Link |
Huseyin Aliz myBiss ApS | Thanks for the hint Walter, works great
![]() Regards, Huseyin Den 21-03-2019 kl. 18:04 skrev Walter Matte: > Grid.DataSet := ADataSet; > for i := 0 to ADataSet.ColumnCount -1 do > begin > col := AGrid.NewColumn; > col.DataColumn := ADataSet.columns[i].Name; > col.Header.Caption := ADataSet.columns[i].Name; > col.Font.Name := 'Arial'; > col.Font.Size := 14; > col.Font.Color := clBlack; > > col.OnCellUpdate := MyCellUpdate; // <<<<<<<<<<<<<<<<<<<<<<<<<< > end; > |
Thu, Mar 21 2019 4:24 PM | Permanent Link |
Huseyin Aliz myBiss ApS | Tim,
Walter was so kind with a hint, now it's working ![]() Regards, Huseyin Den 21-03-2019 kl. 17:57 skrev Tim Young [Elevate Software]: > Huseyin, > > << I usually know what the grid contains of dataset and datacolumns and use oncellupdate in every column to do the task. In this case the grid columns are dynamically populated from 2 different datasets with different fields ![]() > > That's fine, but are you setting the OnCellUpdate event handler ? Without doing that, the event handler won't get triggered for a given grid column. > > Tim Young > Elevate Software > www.elevatesoft.com > |
Fri, Mar 22 2019 4:29 AM | Permanent Link |
Walter Matte Tactical Business Corporation | I can't take credit - Tim asked if you had assigned the event - I just demonstrated how!
I am glad it is working!!! That always feels good. Walter |
This web page was last updated on Sunday, March 26, 2023 at 04:50 AM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |