Re: Динамическое обновление Table Grid

Разобрался!
Нужно было присвоить компонентам События

27

Re: Динамическое обновление Table Grid

Time is an existing method! Try changing time to myTime for example.

Here is my code that works:

var
Timer : TTimer;
iSeconds : integer;


procedure frmMain_On_Show(Sender: TObject; Action string);
begin

     Timer := TTimer.Create (frmMain);
     Timer.Interval := 20000;  //Reset every 20 seconds
     Timer.Enabled := True;
     Timer.OnTimer := @OnTimer;
end;

procedure OnTimer;
begin

     iSeconds := iSeconds + 1;
     frmMain.lbCounter.Caption := ' '+intToStr(iSeconds);
     AutocloseSet;
     if iSeconds > 30 then // This equals 10 minutes approx
     begin
         
          dbUpdateTimer;
          iSeconds := 0;
     end;
end;

procedure dbUpdateTimer;
var
    indx,cnt : integer;
begin

 {update all tables on main form
  cnt := frmMain.ComponentCount -1;
  for indx := 0 to cnt do
  begin
    if frmMain.Components[indx]  is TdbStringGridEx then
        TdbStringGridEx(frmMain.Components[indx]).dbUpdate;
  end; 
 
 {update tables on all other forms}                                                                                           
  frmOrderEntry.grdOrder.dbUpdate;
  frmEditAssemblies.tgMasterPart.dbUpdate;
  frmEditAssemblies.tgSubPart.dbUpdate;
  frmEditPart.grdEditPart.dbUpdate;
  
end;
On a clear disk you can seek forever