Using: Pagemode = True;
DataSetType: dtNonSequenced; (MySQL database)
One Col has to be filled with a AddProgressFormatted.
Because i have to use Pagemode = True, after scrolling new rows appear which also need a "AddProgressFormatted event".
Whitch event should be used?
(i notice that the OnDrawCell and OnGetCellColor events are very inefficient. (these events will trigger to often to do the job)) and demand too much system rescources.
Code to put in the the Event:
if (ARow > 0) and (ACol = 10) then
begin
if (GrdAspect.cells[11, ARow] = 'TEXT') then
begin
GrdAspect.RemoveProgress(10, ARow)
end
else
begin
if Trunc(GrdAspect.CellToReal(10, ARow)) < -1 then
begin
s := 'Nog ' + FloatToStr(Abs(GrdAspect.CellToReal(10, ARow))) + ' dagen';
GrdAspect.AddProgressFormatted(10, ARow,clGreen,clBlack,clInfoBk,clBlack,s, 0, -30 )
end;
if Trunc(GrdAspect.CellToReal(10,ARow)) = -1 then
GrdAspect.AddProgressFormatted(10, ARow,clGreen,clBlack,clInfoBk,clBlack,'Nog 1 dag' , 0, -30 );
if Trunc(GrdAspect.CellToReal(10,ARow)) = 0 then
GrdAspect.AddProgressFormatted(10, ARow,clGreen,clBlack,clInfoBk,clBlack,'Vandaag' , 0, -30 ) ;
if Trunc(GrdAspect.CellToReal(10,ARow)) = 1 then
GrdAspect.AddProgressFormatted(10, ARow,clRed,clBlack,clInfoBk,clBlack,'1 dag te laat',0, 7 );
if Trunc(GrdAspect.CellToReal(10,ARow)) > 1 then
GrdAspect.AddProgressFormatted(10, ARow,clRed,clBlack,clInfoBk,clBlack,'%d dagen te laat',0, 7 );
end;
To have a progressbar in the DBAdvGrid, please use grid.Columns[index].ProgressField = true and additional settings can be set via grid.Columns[index].Progress* properties. There is no need to call grid.AddProgress*()