Browse Source

* Add enable/disablecontrols for target dataset (patch from Luiz Americo, bug ID #26364)

git-svn-id: trunk@28004 -
michael 11 years ago
parent
commit
f1bd08acce
1 changed files with 6 additions and 4 deletions
  1. 6 4
      packages/fcl-db/src/memds/memds.pp

+ 6 - 4
packages/fcl-db/src/memds/memds.pp

@@ -990,9 +990,8 @@ begin
     end;
     end;
   CreateTable;
   CreateTable;
   If CopyData then
   If CopyData then
-    begin
+  begin
     Open;
     Open;
-    OriginalPosition:=Dataset.GetBookmark;
     L1:=TList.Create;
     L1:=TList.Create;
     Try
     Try
       L2:=TList.Create;
       L2:=TList.Create;
@@ -1005,7 +1004,9 @@ begin
           L1.Add(F1);
           L1.Add(F1);
           L2.Add(F2);
           L2.Add(F2);
           end;
           end;
+        DisableControls;
         Dataset.DisableControls;
         Dataset.DisableControls;
+        OriginalPosition:=Dataset.GetBookmark;
         Try
         Try
           Dataset.Open;
           Dataset.Open;
           Dataset.First; //make sure we copy from the beginning
           Dataset.First; //make sure we copy from the beginning
@@ -1039,7 +1040,9 @@ begin
             Dataset.Next;
             Dataset.Next;
             end;
             end;
         Finally
         Finally
+          DataSet.GotoBookmark(OriginalPosition); //Return to original record
           Dataset.EnableControls;
           Dataset.EnableControls;
+          EnableControls;
         end;
         end;
       finally
       finally
         L2.Free;
         L2.Free;
@@ -1047,8 +1050,7 @@ begin
     finally
     finally
       l1.Free;
       l1.Free;
     end;
     end;
-    DataSet.GotoBookmark(OriginalPosition); //Return to original record
-    end;
+  end;
 end;
 end;
 
 
 function TMemDataset.GetRecordBufferPointer(p:TRecordBuffer; Pos:Integer):TRecordBuffer;
 function TMemDataset.GetRecordBufferPointer(p:TRecordBuffer; Pos:Integer):TRecordBuffer;