Procedure

TfrmPCEBaseMain.Sync2Grid

Module

fPCEBaseMain

Last Modified

8/5/2014 10:18:06 AM

Visibility

Protected

Owner

TfrmPCEBaseMain

Declaration

procedure Sync2Grid;

Calls Hierarchy


TfrmPCEBaseMain.Sync2Grid
 └TfrmPCEBaseMain.GetCat

Called-By Hierarchy


            TfrmPCEBaseMain.Sync2Grid
        TfrmProcedures.lbGridSelect┤ 
   TfrmProcedures.btnSelectAllClick┤ 
TfrmProcedures.lbxSectionClickCheck┤ 
       TfrmProcedures.btnOtherClick┤ 
      TfrmProcedures.btnRemoveClick┤ 
       TfrmDiagnoses.btnRemoveClick┤ 
         TfrmDiagnoses.lbGridSelect┘ 

Calls

Name Declaration Comments
TfrmPCEBaseMain.GetCat function GetCat: string; -

Called-By

Name Declaration Comments
TfrmProcedures.btnOtherClick procedure btnOtherClick(Sender: TObject); -
TfrmProcedures.btnRemoveClick procedure btnRemoveClick(Sender: TObject); -
TfrmDiagnoses.btnRemoveClick procedure btnRemoveClick(Sender: TObject); -
TfrmProcedures.btnSelectAllClick procedure btnSelectAllClick(Sender: TObject); -
TfrmProcedures.lbGridSelect procedure lbGridSelect(Sender: TObject); -
TfrmDiagnoses.lbGridSelect procedure lbGridSelect(Sender: TObject); -
TfrmProcedures.lbxSectionClickCheck procedure lbxSectionClickCheck(Sender: TObject; Index: Integer); -


Source

518   procedure TfrmPCEBaseMain.Sync2Grid;
519   var
520     i, idx, cnt, NewIdx: Integer;
521     SCode, SNarr: String;
522     APCEItem: TPCEItem;
523   begin
524     if(FUpdatingGrid or FClosing) then exit;
525     FUpdatingGrid := TRUE;
526     try
527       cnt := 0;
528       idx := -1;
529       for i := 0 to lbGrid.Items.Count - 1 do
530       begin
531         if(lbGrid.Selected[i]) then
532         begin
533           if(idx < 0) then idx := i;
534           inc(cnt);
535           if(cnt > 1) then break;
536         end;
537       end;
538       NewIdx := -1;
539       if(cnt = 1) then
540       begin
541         APCEItem := TPCEItem(lbGrid.Items.Objects[idx]);
542         if APCEItem.Category = GetCat then
543         begin
544           for i := 0 to lbxSection.Items.Count - 1 do
545           begin
546             SCode := Piece(lbxSection.Items[i], U, 1);
547             SNarr := Piece(lbxSection.Items[i], U, 2);
548             if (Pos(APCEItem.Code, SCode) > 0) and (Pos(SNarr, APCEItem.Narrative) > 0)then
549   //          if (Pos(APCEItem.Code, SCode) > 0) then
550             begin
551               NewIdx := i;
552               break;
553             end;
554           end;
555         end;
556       end;
557       lbxSection.ItemIndex := NewIdx;
558     finally
559       FUpdatingGrid := FALSE;
560     end;
561   end;