Drop a TTIWAdvWebGrid on a form.
Add the initialisation code listed at the end of this post. What I want to happen is for the row that I click on to turn red. There should never be more than one red row. Rows that are selected with the checkbox should be green. If I click on a green row outside the checkbox column it should turn red and go back to green when I click on another row.
The results are inconsistent in FF, IE and Chrome. Usually clicking on a selected row makes that row turn red but it stays red even after moving to another row.
I am using IW14.0.37, XE6 and the latest version of the TMS IW component pack.
Am I doing something wrong?
procedure TfrmMain.IWAppFormCreate(Sender: TObject);
grd.Columns.ColumnType := ctCheckbox;
grd.SelectColor := clGreen;
grd.SelectFontColor := clNone;
grd.ActiveRowColor := clRed;
grd.AsyncActiveRowMove := True;
grd.MouseSelect := msMove;
for I := 0 to 10 do
grd.TotalRows := grd.TotalRows + 1;
grd.Cells[1, I] := IntToStr(I);
- To avoid having multiple red rows, please initialize the ActiveRow to -1.
grd.ActiveRow := -1;
- Unfortunately it's currently not supported to use a custom SelectColor and custom ActiveRowColor at the same time with AsyncActiveRowMove enabled.
Please consider to set AsyncActiveRowMove to False or remove one of the SelectColor or ActiveRowColor values.
We'll have to investigate if this behavior can be improved in a future version of the TIWAdvWebGrid.
OK, thanks for your reply.
I think this would be a good feature to have.
In the meantime I have turned off AsyncActiveRowMove and set SelectColor and ActiveRowColor to clNone. The grid behaves as expected except when it only has a single row in it. Grids with just a single row repaint with a different row color when the row is selected with the check box. Grids with more than one row behave correctly (ie the rows stay the same color no matter how many of them are selected).
Please note that if a grid contains only a single row the ActiveRow is automatically set to this row even if ActiveRow is set to -1.
When an ActiveRowColor is defined the one row will be displayed in this color.