Procedure

TfrmTemplateEditor.sbDeleteClick

Module

fTemplateEditor

Last Modified

7/15/2014 3:26:44 PM

Visibility

Public/Published

Owner

TfrmTemplateEditor

Declaration

procedure sbDeleteClick(Sender: TObject);

Calls Hierarchy


TfrmTemplateEditor.sbDeleteClick
 ├TfrmTemplateEditor.AutoDel
 │ └TTemplate.GetBoilerplate
 │   └GetTemplateBoilerplate
 ├TfrmTemplateEditor.CanClone
 │ ├GetFirstPersonalNode
 │ │ └..(rec)..
 │ └TTemplate.CanModify
 │   ├TTemplate.ValidID
 │   └LockTemplate
 ├TfrmTemplateEditor.Clone
 │ ├TfrmTemplateEditor.CanClone...
 │ ├..(rec)..
 │ ├TTemplate.CanModify...
 │ ├TTemplate.Clone
 │ │ ├TTemplate.TrueClone
 │ │ │ ├TTemplate.GetChildren
 │ │ │ ├TTemplate.Create
 │ │ │ │ └TTemplate.ReminderDialogIEN
 │ │ │ ├TTemplate.SetBoilerplate
 │ │ │ │ ├TTemplate.CanModify...
 │ │ │ │ └TTemplate.ValidID
 │ │ │ ├TTemplate.GetBoilerplate...
 │ │ │ ├TTemplate.SetDescription
 │ │ │ │ ├TTemplate.CanModify...
 │ │ │ │ └TTemplate.ValidID
 │ │ │ └TTemplate.GetDescription
 │ │ │   └LoadTemplateDescription
 │ │ ├TTemplate.GetItems
 │ │ │ └ExpandTemplate
 │ │ │   ├TTemplate.GetChildren
 │ │ │   ├GetTemplateChildren
 │ │ │   ├AddTemplate
 │ │ │   │ ├TTemplate.Create...
 │ │ │   │ └TTemplate.AddChild
 │ │ │   │   └TTemplate.GetItems...
 │ │ │   └TTemplate.ItemIENs
 │ │ │     └TTemplate.GetItems...
 │ │ └TTemplate.BackupItems
 │ │   └TTemplate.ItemIENs...
 │ ├TTemplate.RemoveNode
 │ ├MarkDeleted
 │ │ ├TTemplate.ValidID
 │ │ ├TTemplate.SetFileLink
 │ │ │ └TTemplate.AssignFileLink
 │ │ │   ├TTemplate.CanModify...
 │ │ │   ├TTemplate.ValidID
 │ │ │   ├TTemplate.LinkType
 │ │ │   ├TTemplate.SetReminderDialog
 │ │ │   │ ├TTemplate.CanModify...
 │ │ │   │ ├TTemplate.ValidID
 │ │ │   │ ├TTemplate.ReminderDialogIEN
 │ │ │   │ ├TTemplate.LinkType
 │ │ │   │ └TTemplate.SetFileLink...
 │ │ │   ├TTemplate.GetItems...
 │ │ │   └..(rec)..
 │ │ ├TTemplate.GetItems...
 │ │ └..(rec)..
 │ ├TTemplate.AddNode
 │ ├TTemplate.GetItems...
 │ └TfrmTemplateEditor.ShowTemplateType
 ├TTemplate.CanModify...
 ├TTemplate.RemoveChild
 │ ├TTemplate.GetItems...
 │ └TTemplate.CanModify...
 ├MarkDeleted...
 ├TfrmTemplateEditor.Resync
 │ ├TdmodShared.Resync
 │ │ ├InSyncNode
 │ │ ├GetID
 │ │ │ └..(rec)..
 │ │ ├TTemplate.RemoveNode
 │ │ ├BuildNodes
 │ │ │ ├TTemplate.AddNode
 │ │ │ ├TTemplate.GetItems...
 │ │ │ ├..(rec)..
 │ │ │ └TTemplate.GetChildren
 │ │ └GetNode
 │ │   └GetID...
 │ ├TfrmTemplateEditor.EnableNavControls
 │ │ └TfrmTemplateEditor.AllowMove
 │ │   ├TfrmTemplateEditor.IsTemplateLocked
 │ │   │ ├TTemplate.AutoLock
 │ │   │ │ └TTemplate.LinkType
 │ │   │ ├TTemplate.IsLocked
 │ │   │ │ └TTemplate.AutoLock...
 │ │   │ └..(rec)..
 │ │   └TTemplate.GetItems...
 │ └TfrmTemplateEditor.tvTreeChange
 │   ├TfrmTemplateEditor.ChangeTree
 │   ├TfrmTemplateEditor.IsTemplateLocked...
 │   ├TfrmTemplateEditor.EnableControls
 │   │ ├TfrmTemplateEditor.UpdateInsertsDialogs
 │   │ │ ├TfrmTemplateObjects.UpdateStatus
 │   │ │ └TfrmTemplateFields.UpdateStatus
 │   │ │   └TfrmTemplateFields.ValidInsert
 │   │ └TfrmTemplateEditor.EnableNavControls...
 │   └TfrmTemplateEditor.ShowInfo
 │     ├TfrmTemplateEditor.ShowTemplateType
 │     ├TfrmTemplateEditor.GetLinkType
 │     ├LoadServiceListWithSynonyms
 │     ├TTemplate.LinkName
 │     │ ├GetLinkName
 │     │ │ └ExternalName
 │     │ ├TTemplate.LinkIEN
 │     │ └TTemplate.LinkType
 │     ├TTemplate.LinkIEN
 │     ├TTemplate.GetDescription...
 │     ├TTemplate.IsLocked...
 │     ├TTemplate.AutoLock...
 │     ├TfrmTemplateEditor.IsTemplateLocked...
 │     ├TTemplate.GetChildren
 │     ├TTemplate.ReminderDialogIEN
 │     ├TdmodShared.InDialog
 │     │ └TTemplate.IsDialog
 │     ├TTemplate.GetBoilerplate...
 │     ├TfrmTemplateEditor.DisplayBoilerplate
 │     │ ├TfrmTemplateEditor.pnlBoilerplateResize
 │     │ ├TTemplate.GetBoilerplate...
 │     │ ├TTemplate.FullBoilerplate
 │     │ │ ├TTemplate.GetBoilerplate...
 │     │ │ ├TTemplate.ItemBoilerplate
 │     │ │ │ ├TTemplate.GetItems...
 │     │ │ │ ├TTemplate.GetTemplateType
 │     │ │ │ ├DlgText
 │     │ │ │ └TTemplate.DialogProperties
 │     │ │ │   ├TTemplate.GetBoilerplate...
 │     │ │ │   └TTemplate.DlgID
 │     │ │ ├DlgText
 │     │ │ └TTemplate.DialogProperties...
 │     │ ├TfrmTemplateEditor.UpdateInsertsDialogs...
 │     │ ├TfrmTemplateEditor.ShowBoilerPlate
 │     │ └TfrmTemplateEditor.ShowGroupBoilerplate
 │     ├TfrmTemplateEditor.ShowGroupBoilerplate
 │     └TfrmTemplateEditor.pnlBoilerplateResize
 └TfrmTemplateEditor.tvTreeChange...

Called-By Hierarchy


       TfrmTemplateEditor.sbDeleteClick
TfrmTemplateEditor.mnuNodeDeleteClick┤ 
     TfrmTemplateEditor.tvTreeKeyDown┘ 

Calls

Name Declaration Comments
TfrmTemplateEditor.AutoDel function AutoDel(Template: TTemplate): boolean; -
TfrmTemplateEditor.CanClone function CanClone(const Node: TTreeNode): boolean; -
TTemplate.CanModify function CanModify: boolean; -
TfrmTemplateEditor.Clone function Clone(Node: TTreeNode): boolean; -
MarkDeleted procedure MarkDeleted(Template: TTemplate); -
TTemplate.RemoveChild procedure RemoveChild(Child: TTemplate); -
TfrmTemplateEditor.Resync procedure Resync(const Templates: array of TTemplate); -
TfrmTemplateEditor.tvTreeChange procedure tvTreeChange(Sender: TObject; Node: TTreeNode); -

Called-By

Name Declaration Comments
TfrmTemplateEditor.mnuNodeDeleteClick procedure mnuNodeDeleteClick(Sender: TObject); -
TfrmTemplateEditor.tvTreeKeyDown procedure tvTreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); -


Source

1754  procedure TfrmTemplateEditor.sbDeleteClick(Sender: TObject);
1755  var
1756    PNode, Node: TTreeNode;
1757    Template, Parent: TTemplate;
1758    DoIt: boolean;
1759    Answer: Word;
1760  
1761  begin
1762    if ((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
1763      (assigned(FCurTree.Selected.Parent))) then
1764    begin
1765      Node := FCurTree.Selected;
1766      Template := TTemplate(Node.Data);
1767      PNode := Node.Parent;
1768      Parent := TTemplate(PNode.Data);
1769      if (AutoDel(Template)) then
1770        DoIt := TRUE
1771      else
1772        if (Template.Active) and (cbActive.Checked) then
1773        begin
1774          DoIt := FALSE;
1775          Answer := MessageDlg('Once you delete a template you may not be able to retrieve it.' + CRLF +
1776            'Rather than deleting, you may want to inactivate a template instead.' + CRLF +
1777            'You may inactivate this template by pressing the Ignore button now.' + CRLF +
1778            'Are you sure you want to delete the "' + Node.Text +
1779            '" Template?', mtConfirmation, [mbYes, mbNo, mbIgnore], 0);
1780          if (Answer = mrYes) then
1781            DoIt := TRUE
1782          else
1783            if (Answer = mrIgnore) then
1784              cbActive.Checked := FALSE;
1785        end
1786        else
1787          DoIt := InfoBox('Are you sure you want to delete the "' + Node.Text +
1788            '" Template?', 'Confirmation', MB_YESNO or MB_ICONQUESTION) = IDYES;
1789      if (DoIt and CanClone(PNode)) then
1790      begin
1791        if (Clone(PNode)) then
1792          Parent := TTemplate(PNode.Data);
1793        if assigned(Parent) and Parent.CanModify then
1794        begin
1795          btnApply.Enabled := TRUE;
1796          Parent.RemoveChild(Template);
1797          MarkDeleted(Template);
1798          Resync([Parent]);
1799          tvTreeChange(FCurTree, FCurTree.Selected);
1800        end;
1801      end;
1802    end;
1803  end;