Procedure

TfrmTemplateEditor.EnableNavControls

Module

fTemplateEditor

Last Modified

7/15/2014 3:26:44 PM

Visibility

Protected

Owner

TfrmTemplateEditor

Declaration

procedure EnableNavControls;

Calls Hierarchy


TfrmTemplateEditor.EnableNavControls
 └TfrmTemplateEditor.AllowMove
   ├TfrmTemplateEditor.IsTemplateLocked
   │ ├TTemplate.AutoLock
   │ │ └TTemplate.LinkType
   │ ├TTemplate.IsLocked
   │ │ └TTemplate.AutoLock...
   │ └..(rec)..
   └TTemplate.GetItems
     └ExpandTemplate
       ├TTemplate.GetChildren
       ├GetTemplateChildren
       ├AddTemplate
       │ ├TTemplate.Create
       │ │ └TTemplate.ReminderDialogIEN
       │ └TTemplate.AddChild
       │   └TTemplate.GetItems...
       └TTemplate.ItemIENs
         └TTemplate.GetItems...

Called-By Hierarchy


                TfrmTemplateEditor.EnableNavControls
                 TfrmTemplateEditor.EnableControls┤ 
                 TfrmTemplateEditor.tvTreeChange┘ │ 
              TfrmTemplateEditor.cbActiveClick┤   │ 
                TfrmTemplateEditor.tvTreeEnter┤   │ 
              TfrmTemplateEditor.cbShHideClick┤   │ 
            TfrmTemplateEditor.cbActiveClick┘ │   │ 
             TfrmTemplateEditor.cbPerHideClick┤   │ 
            TfrmTemplateEditor.cbActiveClick┘ │   │ 
              TfrmTemplateEditor.sbDeleteClick┤   │ 
       TfrmTemplateEditor.mnuNodeDeleteClick┤ │   │ 
            TfrmTemplateEditor.tvTreeKeyDown┘ │   │ 
                     TfrmTemplateEditor.Resync┤   │ 
              TfrmTemplateEditor.btnNewClick┤ │   │ 
                             EditTemplates┤ │ │   │ 
     TfrmDCSumm.popSummMemoTemplateClick┤ │ │ │   │ 
          TfrmDCSumm.mnuNewTemplateClick┤ │ │ │   │ 
        TfrmDCSumm.mnuEditTemplatesClick┤ │ │ │   │ 
  TfrmDCSumm.mnuEditSharedTemplatesClick┤ │ │ │   │ 
    TfrmDCSumm.mnuNewSharedTemplateClick┤ │ │ │   │ 
   TfrmConsults.popNoteMemoTemplateClick┤ │ │ │   │ 
      TfrmConsults.mnuEditTemplatesClick┤ │ │ │   │ 
        TfrmConsults.mnuNewTemplateClick┤ │ │ │   │ 
TfrmConsults.mnuEditSharedTemplatesClick┤ │ │ │   │ 
  TfrmConsults.mnuNewSharedTemplateClick┤ │ │ │   │ 
       TfrmDrawers.mnuEditTemplatesClick┤ │ │ │   │ 
         TfrmDrawers.mnuNewTemplateClick┤ │ │ │   │ 
    TfrmSurgery.popNoteMemoTemplateClick┤ │ │ │   │ 
       TfrmSurgery.mnuEditTemplatesClick┤ │ │ │   │ 
         TfrmSurgery.mnuNewTemplateClick┤ │ │ │   │ 
 TfrmSurgery.mnuEditSharedTemplatesClick┤ │ │ │   │ 
   TfrmSurgery.mnuNewSharedTemplateClick┤ │ │ │   │ 
      TfrmNotes.popNoteMemoTemplateClick┤ │ │ │   │ 
         TfrmNotes.mnuEditTemplatesClick┤ │ │ │   │ 
           TfrmNotes.mnuNewTemplateClick┤ │ │ │   │ 
   TfrmNotes.mnuEditSharedTemplatesClick┤ │ │ │   │ 
     TfrmNotes.mnuNewSharedTemplateClick┘ │ │ │   │ 
        TfrmTemplateEditor.mnuAutoGenClick┤ │ │   │ 
 TfrmTemplateEditor.mnuImportTemplateClick┘ │ │   │ 
            TfrmTemplateEditor.sbMoveUpClick┤ │   │ 
          TfrmTemplateEditor.sbMoveDownClick┤ │   │ 
         TfrmTemplateEditor.sbDeleteClick...┤ │   │ 
           TfrmTemplateEditor.tvTreeDragDrop┤ │   │ 
        TfrmTemplateEditor.sbCopyLeftClick┤ │ │   │ 
       TfrmTemplateEditor.sbCopyRightClick┤ │ │   │ 
      TfrmTemplateEditor.mnuNodePasteClick┘ │ │   │ 
             TfrmTemplateEditor.mnuSortClick┤ │   │ 
           TfrmTemplateEditor.TemplateLocked┘ │   │ 
             TfrmTemplateEditor.FormCreate┘   │   │ 
              TfrmTemplateEditor.SharedEditing┤   │ 
               TfrmTemplateEditor.FormCreate┤ │   │ 
        TfrmTemplateEditor.cbEditSharedClick┘ │   │ 
              TfrmTemplateEditor.cbxTypeChange┘   │ 
                  TfrmTemplateEditor.cbActiveClick┤ 
               TfrmTemplateEditor.cbShHideClick...┤ 
              TfrmTemplateEditor.cbPerHideClick...┤ 
                      TfrmTemplateEditor.Resync...┘ 

Calls

Name Declaration Comments
TfrmTemplateEditor.AllowMove function AllowMove(ADropNode, ADragNode: TTreeNode): boolean; -

Called-By

Name Declaration Comments
TfrmTemplateEditor.cbActiveClick procedure cbActiveClick(Sender: TObject); -
TfrmTemplateEditor.cbPerHideClick procedure cbPerHideClick(Sender: TObject); -
TfrmTemplateEditor.cbShHideClick procedure cbShHideClick(Sender: TObject); -
TfrmTemplateEditor.EnableControls procedure EnableControls(ok, Root: boolean); -
TfrmTemplateEditor.Resync procedure Resync(const Templates: array of TTemplate); -


Source

1805  procedure TfrmTemplateEditor.EnableNavControls;
1806  var
1807    i: TTemplateTreeControl;
1808    AllowUp, AllowDown, AllowSet: boolean;
1809    Node: TTreeNode;
1810    Tree: TTemplateTreeType;
1811    Curok: boolean;
1812    OldActiveControl: TControl;
1813  begin
1814    if (Assigned(FCurTree)) then
1815    begin
1816      Tree := TTemplateTreeType(FCurTree.Tag);
1817      Node := FCurTree.Selected;
1818      if (Assigned(Node)) then
1819        Curok := (TTemplate(Node.Data).RealType in [ttDoc, ttGroup, ttClass])
1820      else
1821        Curok := FALSE;
1822      if (Curok) then
1823      begin
1824        OldActiveControl := ActiveControl;
1825        FTreeControl[Tree, tcDel].Enabled := TRUE;
1826        AllowSet := FALSE;
1827        if (Node.Index > 0) then
1828          AllowUp := TRUE
1829        else
1830        begin
1831          AllowUp := AllowMove(Node.Parent.Parent, Node);
1832          AllowSet := TRUE;
1833        end;
1834        FTreeControl[Tree, tcUp].Enabled := AllowUp;
1835        AllowDown := AllowUp;
1836        if (Node.Index < (Node.Parent.Count - 1)) then
1837          AllowDown := TRUE
1838        else
1839        begin
1840          if (not AllowSet) then
1841            AllowDown := AllowMove(Node.Parent.Parent, Node);
1842        end;
1843        FTreeControl[Tree, tcDown].Enabled := AllowDown;
1844        if not AllowUp and (OldActiveControl = FTreeControl[Tree, tcUp]) then
1845          (FTreeControl[Tree, tcDown] as TWinControl).SetFocus;
1846        if not AllowDown and (OldActiveControl = FTreeControl[Tree, tcDown]) then
1847          (FTreeControl[Tree, tcUp] as TWinControl).SetFocus;
1848        FTreeControl[Tree, tcCopy].Enabled := FTreeControl[TTemplateTreeType(1 - ord(Tree)), tcDel].Visible;
1849        if (FTreeControl[Tree, tcCopy].Enabled) then
1850        begin
1851          if (Tree = ttShared) then
1852            Node := tvPersonal.Selected
1853          else
1854            Node := tvShared.Selected;
1855          if (assigned(Node)) then
1856          begin
1857            if (TTemplate(Node.Data).RealType = ttDoc) then
1858              Node := Node.Parent;
1859            FTreeControl[Tree, tcCopy].Enabled := AllowMove(Node, FCurTree.Selected);
1860          end
1861          else
1862            FTreeControl[Tree, tcCopy].Enabled := FALSE;
1863        end;
1864        FTreeControl[Tree, tcLbl].Enabled := FTreeControl[Tree, tcCopy].Enabled;
1865      end
1866      else
1867      begin
1868        for i := low(TTemplateTreeControl) to high(TTemplateTreeControl) do
1869          FTreeControl[Tree, i].Enabled := FALSE;
1870      end;
1871      if (FCurTree = tvShared) and (FCanEditShared) then
1872        btnNew.Enabled := TRUE
1873      else
1874        if (FCurTree = tvPersonal) and (FCanEditPersonal) then
1875          btnNew.Enabled := TRUE
1876        else
1877          btnNew.Enabled := FALSE;
1878    end
1879    else
1880      btnNew.Enabled := FALSE;
1881  end;