Procedure

TfrmReview.lstReviewClickCheck

Module

fReview

Last Modified

7/15/2014 3:26:38 PM

Comments

Prevent grayed checkboxes from being changed to anything else

Visibility

Public/Published

Owner

TfrmReview

Declaration

procedure lstReviewClickCheck(Sender: TObject);

Calls Hierarchy


TfrmReview.lstReviewClickCheck
 ├TSigItems.EnableSettings
 │ └TSigItems.TagToItem
 ├updateAllChilds
 │ └TSigItems.EnableSettings...
 └TfrmReview.IsSignatureRequired

Calls

Name Declaration Comments
TSigItems.EnableSettings procedure EnableSettings(Index: integer; Checked: boolean); -
TfrmReview.IsSignatureRequired function IsSignatureRequired:boolean; -
updateAllChilds procedure updateAllChilds(CheckedStatus: boolean; ParentOrderId: string); -


Source

920   procedure TfrmReview.lstReviewClickCheck(Sender: TObject);
921   { prevent grayed checkboxes from being changed to anything else }
922   var
923     ChangeItem: TChangeItem;
924   
925     procedure updateAllChilds(CheckedStatus: boolean; ParentOrderId: string);
926     var
927       idx: integer;
928       AChangeItem: TChangeItem;
929     begin
930       for idx := 0 to lstReview.Items.Count - 1 do
931       begin
932         AChangeItem := TChangeItem(lstReview.Items.Objects[idx]);
933         if Assigned(AChangeItem) and (AChangeItem.ParentID = ParentOrderId) then
934             if lstReview.Checked[idx] <> CheckedStatus then
935             begin
936               lstReview.Checked[idx] := CheckedStatus;
937               SigItems.EnableSettings(idx, lstReview.checked[Idx]);
938             end;
939       end;
940     end;
941   
942   begin
943     with lstReview do
944     begin
945       ChangeItem := TChangeItem(Items.Objects[ItemIndex]);
946       if ItemIndex > 0 then
947       begin
948          if (ChangeItem <> nil) then
949          begin
950            if (ChangeItem.SignState = CH_SIGN_NA) then State[ItemIndex] := cbGrayed
951            else
952            begin
953              SigItems.EnableSettings(ItemIndex, checked[ItemIndex]);
954              if Length(ChangeItem.ParentID) > 0 then
955                updateAllChilds(checked[ItemIndex], ChangeItem.ParentID);
956            end;
957          end;
958        end;
959        pnlSignature.Visible := IsSignatureRequired;
960     end;
961     if pnlSignature.Visible then txtESCode.SetFocus;
962   
963   end;