Parcourir la source

变更令,复制粘贴变更性质列数据时,如果复制粘贴不符合规范,则删除。

MaiXinRong il y a 9 ans
Parent
commit
3c4feb9410
2 fichiers modifiés avec 12 ajouts et 3 suppressions
  1. 1 3
      Frames/BGLFme.dfm
  2. 11 0
      Frames/BGLFme.pas

+ 1 - 3
Frames/BGLFme.dfm

@@ -127,11 +127,9 @@ object BGLFrame: TBGLFrame
         Selection.TransparentColor = False
         FrozenCol = 0
         FrozenRow = 0
+        OnCellTextChanged = zgBGLCellTextChanged
         OnCopy = zgBGLCopy
         OnPaste = zgBGLPaste
-        OnGetCellEditor = zgBGLGetCellEditor
-        OnEditorLoadCell = zgBGLEditorLoadCell
-        OnEditorSaveCell = zgBGLEditorSaveCell
         OnMouseDown = zgBGLMouseDown
         Align = alClient
       end

+ 11 - 0
Frames/BGLFme.pas

@@ -56,6 +56,7 @@ type
       AControl: TWinControl);
     procedure zgBGLEditorLoadCell(Sender: TObject; ACoord: TPoint;
       AControl: TWinControl);
+    procedure zgBGLCellTextChanged(Sender: TObject; Col, Row: Integer);
   private
     FBGLData: TBGLData;
 
@@ -237,4 +238,14 @@ begin
       cbbBGLType.Text := zaBGL.DataSet.FieldByName('BGLType').AsString;
 end;
 
+procedure TBGLFrame.zgBGLCellTextChanged(Sender: TObject; Col,
+  Row: Integer);
+begin
+  if Col = 6 then
+  begin
+    if (zgBGL.Cells[Col, Row].Text <> '') and (cbbBGLType.Items.IndexOf(zgBGL.Cells[Col, Row].Text) = -1) then
+      zgBGL.Cells[Col, Row].Text := '';
+  end;
+end;
+
 end.