I need advice about the following situation. These are my design settings:
object cdsMonitor: TClientDataSet
Active = True
…
object cdsMonitorSendReceive: TBooleanField
FieldName = 'SendReceive'
end
object cdsMonitorMessage: TStringField
FieldName = 'Message'
end
object cdsMonitorTime: TTimeField
FieldName = 'Time'
end
end
object dsMonitor: TDataSource
DataSet = cdsMonitor
…
end
object dbgMonitor: TDBGrid
…
DataSource = dsMonitor
…
end
I am adding data to the dataset with the following code:
cdsMonitor.Append;
cdsMonitorSendReceive.Value := False;
cdsMonitorMessage.Value := Bytes;
cdsMonitorTime.Value := Now;
cdsMonitor.Post;
In the application source there is a function that executes the above block of code several times (in a loop). The problem is that I don’t see the appended rows appearing one by one but for several seconds I don’t see anything (the function is time consuming) and then all the appended rows appear simultaneously. I want to see the result not only when the code execution has finished but I want the DBGrid to be refreshed after each appended row so that I can watch the progress in real time. I can achieve this by adding
Application.ProcessMessages;
to the above block of code. However this interferes with the normal flow of code execution because not only the grid is updated but other messages are processed as well which is not desirable. So this is not the solution I am looking for. Any other ideas?
YourGrid.DataSource.DataSet.Refreshwouldn't help ? [just a guess] - TLamaRefreshdoesn't work. - Rick77