Problem with DisableControls

In this forum all bug reports concerning the 6.x branch will be gahtered. You have the possibility to track the bug fix process.

Moderators: EgonHugeist, mdaems

Post Reply
rpelisson
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 23.01.2006, 12:26

Problem with DisableControls

Post by rpelisson »

Hello there! Sorry my bad english...

I'm using a DisableControls with a ZQuery or ZReadOnlyQuery, the cursor of DataSet stay freak.

Example: The Query returned 5 rows and in a loop command from the first to the last record, using DisableControls command. The cursor stay freak, it's pass for record nº 3 and jump to the End of File (EOF).

See the code:

Code: Select all


  DmSoftware.Tab_Cli_X_Soft.First;
  DmSoftware.Tab_Cli_X_Soft.DisableControls;

  while not DmSoftware.Tab_Cli_X_Soft.EOF do
    begin
      DmSoftware.Tab_Sistemas.Locate('Nome_Software', DmSoftware.Tab_Cli_X_SoftSistemas.AsString, []);

      if (DmSoftware.Tab_Cli_X_SoftSistemas.AsString = DmSoftware.Tab_SistemasNome_Software.AsString) then
        begin
          DmSoftware.Tab_Cli_X_Soft.Edit;
          L.FiltraSql(DMSoftware.Q_Pesq, ' Top 1 Nome_Software, Versao', 'Cod_x_Software', 'Nome_Software='+#39+DMSoftware.Tab_Cli_x_SoftSistemas.AsString+#39+' Order by Data desc');
          DmSoftware.Tab_Cli_X_SoftVersao_Extra.AsString := DMSoftware.Q_Pesq.FieldbyName('Versao').AsString;
          DmSoftware.Tab_Cli_X_Soft.Post;
        End;
      DmSoftware.Tab_Cli_X_Soft.Next;

    end;    // while

  DmSoftware.Tab_Cli_X_Soft.EnableControls;
  DmSoftware.Tab_Cli_X_Soft.First;
rpelisson
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 23.01.2006, 12:26

Post by rpelisson »

Oops, I found a solution for myself.

I modify the method ApplyUpdates in ZAbstractDataSet.pas

see commented lines

Code: Select all


procedure TZAbstractDataset.ApplyUpdates;
begin
  if not Active then Exit;

  Connection.ShowSQLHourGlass;
  try
    if State in [dsEdit, dsInsert] then Post;

    if CachedResultSet <> nil then
      CachedResultSet.PostUpdates;

    // Updated
    // 22/11/2006
    // The Resync command from DB.pas was freak the cursor operations

{ ** Commented
    if not (State in [dsInactive]) then
      Resync([]);
}

  finally
    Connection.HideSqlHourGlass;
  end;
end;

bangfauzan
Senior Boarder
Senior Boarder
Posts: 50
Joined: 31.08.2006, 10:41
Contact:

Post by bangfauzan »

Oh..... I think that's not proper solution.
In your case, you use Post method and not ApplyUpdates.
why you revise ApplyUpdates method?

Post method does not call ApplyUpdates,
while ApplyUpdates calls (some thime, if dataset being edited or inserted)
Post method.

Regards
Post Reply