Procedure

TfrmPCEBaseMain.btnRemoveClick

Module

fPCEBaseMain

Last Modified

8/5/2014 10:18:06 AM

Visibility

Public/Published

Owner

TfrmPCEBaseMain

Declaration

procedure btnRemoveClick(Sender: TObject);

Calls Hierarchy


TfrmPCEBaseMain.btnRemoveClick
 ├TfrmPCEBaseMain.GetCat
 └TfrmPCEBaseGrid.ClearGrid
   └TfrmPCEBaseGrid.UpdateControls

Calls

Name Declaration Comments
TfrmPCEBaseGrid.ClearGrid procedure ClearGrid; -
TfrmPCEBaseMain.GetCat function GetCat: string; -


Source

229   procedure TfrmPCEBaseMain.btnRemoveClick(Sender: TObject);
230   var
231     i, j: Integer;
232     APCEItem: TPCEItem;
233     CurCategory, SCode, SNarr: String;
234   begin
235     inherited;
236     FUpdatingGrid := TRUE;
237     try
238       for i := lbGrid.Items.Count-1 downto 0 do if(lbGrid.Selected[i]) then
239       begin
240         CurCategory := GetCat;
241         APCEItem := TPCEDiag(lbGrid.Items.Objects[i]);
242         if APCEItem.Category = CurCategory then
243         begin
244           for j := 0 to lbxSection.Items.Count - 1 do
245           begin
246             SCode := Piece(lbxSection.Items[j], U, 1);
247             SNarr := Piece(lbxSection.Items[j], U, 2);
248             if (Pos(APCEItem.Code, SCode) > 0) and (Pos(SNarr, APCEItem.Narrative) > 0) then
249   //          if (Pos(APCEItem.Code, SCode) > 0) then
250               lbxSection.Checked[j] := False;
251           end;
252         end;
253         APCEItem.Free;
254         lbGrid.Items.Delete(i);
255       end;
256       ClearGrid;
257     finally
258       FUpdatingGrid := FALSE;
259     end;
260   end;