You are not logged in.
Pages: 1
hallo..,
what is exactly method to use to refreshing data in the grid using TSQLTableToGrid
i have the code like this :
procedure TFrameMain.RefreshNumber;
begin
fTable2:= MainForm.Client.ListFmt([TSQLNumber2],
FormatUTF8(aSelect,['Number2','Number2','Number2','Number2']),aWC,[fMasterCodeID]);
fGrid2:= TSQLTableToGrid.Create(dg2,fTable2,MainForm.Client);
fGrid2.OnDrawCellBackground:=DoDrawCell;
with fGrid2 do begin
SortForce(1,False);
SetFieldFixedWidth(40);
SetFieldLengthMean('caaa',False);
end;
with dg2 do begin
ColWidths[ColCount-2]:= 20;
ColWidths[ColCount-1]:= 20;
Row:= 1;
end;
fTable3:= MainForm.Client.ListFmt([TSQLNumber3],
FormatUTF8(aSelect,['Number3','Number3','Number3','Number3']),aWC,[fMasterCodeID]);
fGrid3:= TSQLTableToGrid.Create(dg3,fTable3,MainForm.Client);
fGrid3.OnDrawCellBackground:=DoDrawCell;
with fGrid3 do begin
SortForce(1,False);
SetFieldFixedWidth(40);
SetFieldLengthMean('caaa',False);
end;
with dg3 do begin
ColWidths[ColCount-2]:= 20;
ColWidths[ColCount-1]:= 20;
Row:= 1;
end;
fTable4:= MainForm.Client.ListFmt([TSQLNumber4],
FormatUTF8(aSelect,['Number4','Number4','Number4','Number4']),aWC,[fMasterCodeID]);
fGrid4:= TSQLTableToGrid.Create(dg4,fTable4,MainForm.Client);
fGrid4.OnDrawCellBackground:=DoDrawCell;
with fGrid4 do begin
SortForce(1,False);
SetFieldFixedWidth(50);
SetFieldLengthMean('caaa',False);
end;
with dg4 do begin
ColWidths[ColCount-3]:= 40;
ColWidths[ColCount-2]:= 20;
ColWidths[ColCount-1]:= 20;
Row:= 1;
end;
end;
Where Clause parameter is fMasterCodeID, as shown above. This procedure is work as expected, except flicker on the grid.
i want more smooth and no flicker.
i tried use something like fGrid4.Refresh, and fGrid4.refresh(true) but not work.
many thanks.
Offline
I think you're recreating every content everytime... this is not the way to do it.
You'll have to add a timer to call fGrid4.Refresh and update the content only if Refreshed as been returned as TRUE.
Online
but, i want to refresh the content of the grid immediately after the fMasterCodeID changed.
i changed the name of the procedure above to TFrameMain.InitNumber and execute only one time on then constructor TFrameMain.Create.
and i create new procedure for refreshing/requery content when the fMasterCodeID changed.
procedure TFrameMain.RefreshNumber;
begin
fTable2:= fClient.ListFmt([TSQLNumber2],
FormatUTF8(aSelect,['Number2','Number2','Number2','Number2']),aWC,[fMasterCodeID]);
if fGrid2.Refresh(True) then
fGrid2.Refresh;
end;
but still not working..
Offline
Pages: 1