Procedure

TfrmRemCoverSheet.UpdateButtons

Module

fRemCoverSheet

Last Modified

7/15/2014 3:26:38 PM

Visibility

Private

Owner

TfrmRemCoverSheet

Declaration

procedure UpdateButtons;

Calls Hierarchy


TfrmRemCoverSheet.UpdateButtons
 ├TfrmRemCoverSheet.GetCurrent
 │ └TfrmRemCoverSheet.GetCoverSheetLvlData
 │   └GetCoverSheetLevelData
 ├TfrmRemCoverSheet.GetIndex
 └TfrmRemCoverSheet.LockButtonUpdate
   ├TfrmRemCoverSheet.btnLockClick
   │ └TfrmRemCoverSheet.ChangeStatus
   │   ├TfrmRemCoverSheet.GetCurrent...
   │   ├TfrmRemCoverSheet.GetIndex
   │   ├TfrmRemCoverSheet.MarkListAsChanged
   │   │ └TfrmRemCoverSheet.UpdateView
   │   │   └TfrmRemCoverSheet.GetCurrent...
   │   ├TfrmRemCoverSheet.SetupItem
   │   └TfrmRemCoverSheet.LockButtonUpdate...
   └TfrmRemCoverSheet.btnAddClick
     └TfrmRemCoverSheet.ChangeStatus...

Called-By Hierarchy


            TfrmRemCoverSheet.UpdateButtons
                   TfrmRemCoverSheet.Init┤ 
             EditCoverSheetReminderList┘ │ 
  TfrmReminderTree.mnuCoverSheetClick┤   │ 
               DialogOptionsReminders┘   │ 
 TfrmOptions.btnCoverRemindersClick┘     │ 
   TfrmRemCoverSheet.UpdateMasterListView┤ 
     TfrmRemCoverSheet.cbEditLevelClick┤ │ 
   TfrmRemCoverSheet.cbxDropDownClose┘ │ │ 
TfrmRemCoverSheet.cbxDivisionChange┤   │ │ 
 TfrmRemCoverSheet.cbxServiceChange┤   │ │ 
TfrmRemCoverSheet.cbxLocationChange┤   │ │ 
   TfrmRemCoverSheet.cbxClassChange┤   │ │ 
    TfrmRemCoverSheet.cbxUserChange┤   │ │ 
 TfrmRemCoverSheet.lvViewSelectItem┘   │ │ 
   TfrmRemCoverSheet.lvViewChange┘     │ │ 
     TfrmRemCoverSheet.sbCopyRightClick┤ │ 
      TfrmRemCoverSheet.sbCopyLeftClick┤ │ 
             TfrmRemCoverSheet.SaveData┘ │ 
      TfrmRemCoverSheet.btnApplyClick┤   │ 
         TfrmRemCoverSheet.btnOKClick┘   │ 
           TfrmRemCoverSheet.edtSeqChange┤ 
            TfrmRemCoverSheet.tvAllChange┤ 
          TfrmRemCoverSheet.lvCoverChange┤ 
              TfrmRemCoverSheet.sbUpClick┤ 
            TfrmRemCoverSheet.sbDownClick┤ 
   TfrmRemCoverSheet.ActiveControlChanged┘ 
         TfrmRemCoverSheet.btnViewClick┤   
           TfrmRemCoverSheet.FormCreate┘   

Calls

Name Declaration Comments
TfrmRemCoverSheet.GetCurrent function GetCurrent(IEN: Int64; Level: TRemCoverDataLevel; Show: boolean; Add: boolean = FALSE): TORStringList; -
TfrmRemCoverSheet.GetIndex function GetIndex(List: TORStringList; Item: TListItem): integer; -
TfrmRemCoverSheet.LockButtonUpdate procedure LockButtonUpdate(data, FNAME, hint: string); -

Called-By

Name Declaration Comments
TfrmRemCoverSheet.ActiveControlChanged procedure ActiveControlChanged(Sender: TObject); -
TfrmRemCoverSheet.edtSeqChange procedure edtSeqChange(Sender: TObject); -
TfrmRemCoverSheet.Init procedure Init(AsUser: boolean); -
TfrmRemCoverSheet.lvCoverChange procedure lvCoverChange(Sender: TObject; Item: TListItem; Change: TItemChange); -
TfrmRemCoverSheet.sbDownClick procedure sbDownClick(Sender: TObject); -
TfrmRemCoverSheet.sbUpClick procedure sbUpClick(Sender: TObject); -
TfrmRemCoverSheet.tvAllChange procedure tvAllChange(Sender: TObject; Node: TTreeNode); -
TfrmRemCoverSheet.UpdateMasterListView procedure UpdateMasterListView; -


Source

888   procedure TfrmRemCoverSheet.UpdateButtons;
889   var
890     FocusOK, ok: boolean;
891     i, idx: integer;
892     Current, Lowest, Highest: integer;
893     tmp: string;
894     tmpSL: TORstringlist;
895     doDownButton, doUpButton: boolean;
896   
897   begin
898     lvCover.Enabled := (FEditingLevel <> dlPackage);
899     ok := assigned(tvAll.Selected) and (FEditingLevel <> dlPackage) and (FSelection);
900     sbCopyRight.Enabled := ok;
901   
902     ok := assigned(lvCover.Selected) and (FEditingLevel <> dlPackage) and (FSelection);
903     sbCopyLeft.Enabled := ok;
904   
905     ok := assigned(lvCover.Selected);
906     lblSeq.Enabled := ok;
907     edtSeq.Enabled := ok;
908   
909     FUpdating := TRUE;
910     try
911       udSeq.Enabled := ok;
912       if ok then
913         udSeq.Position := StrToIntDef(lvCover.Selected.SubItems[IdxSeq],1)
914       else
915         udSeq.Position := 1;
916     finally
917       FUpdating := FALSE;
918     end;
919   
920     FocusOK := lvCover.Focused or sbUp.Focused or sbDown.Focused or edtSeq.Focused or
921                udSeq.Focused or btnAdd.Focused or btnRemove.Focused or btnLock.Focused or
922                btnOK.Focused; // add btnOK so you can shift-tab backwards into list
923     btnAdd.Enabled := ok and FocusOK;
924     btnRemove.Enabled := ok and (FEditingLevel <> dlSystem) and FocusOK;
925     btnLock.Enabled := ok and (FEditingLevel <> dlUser) and FocusOK;
926     if ok then
927     begin
928       tmpSL := GetCurrent(FEditingIEN, FEditingLevel, FALSE);
929       if assigned(tmpSL) then
930       begin
931         Idx := GetIndex(tmpSL, lvCover.Selected);
932         if Idx >= 0 then
933         begin
934           tmp := tmpSL[idx];
935           tmp := piece(tmp,u,2);
936           tmp := copy(tmp,1,1);
937           if tmp = 'L' then
938           begin
939             LockButtonUpdate('Unlock', 'BMP_UNLOCK', UnlockHint);
940           end;
941           if tmp = 'N' then
942           begin
943             LockButtonUpdate('Lock', 'BMP_LOCK', LockHint);
944           end;
945           if tmp = 'R' then
946           begin
947             LockButtonUpdate('Add && Lock', 'BMP_LOCK', AddLockHint);
948           end;
949         end;
950       end;
951       ok :=(lvCover.Items.Count > 1);
952     end;
953     Lowest := 99999;
954     Highest := -1;
955     if ok then
956     begin
957       for i := 0 to lvCover.Items.Count-1 do
958       begin
959         Current := StrToIntDef(lvCover.Items[i].SubItems[IdxSeq], 0);
960         if Lowest > Current then
961           Lowest := Current;
962         if Highest < Current then
963           Highest := Current;
964       end;
965       Current := StrToIntDef(lvCover.Selected.SubItems[IdxSeq], 0);
966     end
967     else
968       Current := 0;
969     doDownButton := (sbUp.Focused and (Current = Lowest));
970     doUpButton := (sbDown.Focused and (Current = Highest));
971     sbUp.Enabled := ok and (Current > Lowest);
972     sbDown.Enabled := ok and (Current < Highest);
973     if doDownButton and sbDown.enabled then sbDown.SetFocus;
974     if doUpButton and sbUp.enabled then sbUp.SetFocus;
975   end;