I have a editor which is built using a TDBGrid component and stores
x,y coordinates in incremental form ie. as deltax, deltay in each table
row. I need to accumulate the deltax,deltay incremental data stored
in the grid in order to plot coordinates of the point represented by the
current table row.
The following code is called from the Dataset OnDataChange event
to do this accumulation. It does this OK, but has an unfortunate side
effect - it also suppresses the response to any keypress events
effectively preventing editing of the data.
I'm struggling to find a way of avoiding this problem. Can anyone
help?
//Code segiment called from the OnDataChange event
//cds1 is the dataset assigned to a TDBGrid component
cds1.DisableControls; //Disable dbgrid updating
recno := cds1.recNo;
SavePlace := cds1.GetBookmark;
try
dX := dPlotAdditionalX; //Global
dZ := dPlotAdditionalZ; //Global
while not cds1.Bof do
begin
cds1.Prior;
//Extract point data from the current row
CalculatePoint(dX1,dZ1);
if dX1 <> -9999 then
dX := dX + dX1;
if dZ1 <> -9999 then
dZ := dZ + dZ1;
end;
finally
cds1.GotoBookmark(SavePlace);
cds1.FreeBookmark(SavePlace);
cds1.EnableControls; //Enable dbgrid updating
end;
Cheers
Jeremy Walsh
================================================
Jeremy Walsh
River Hydraulics Scientist
NIWA
10 Kyle Street, Riccarton
Christchurch 8003, New Zealand
Ph: 0064 3 348 8987, Fax: 0064 3 348 5548
DDI: 0064 3 343 7877
www.niwa.co.nz
================================================
_______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi
