Procedure

TdmodShared.AddTemplateNode

Module

dShared

Last Modified

7/15/2014 3:26:36 PM

Visibility

Public

Owner

TdmodShared

Declaration

procedure AddTemplateNode(Tree: TTreeView; var EmptyCount: integer;
                          const tmpl: TTemplate; AllowInactive: boolean = FALSE;
                          const Owner: TTreeNode = nil);

Calls Hierarchy


TdmodShared.AddTemplateNode
 ├AddChildObject
 │ └TTemplate.AddNode
 └TTemplate.GetChildren

Called-By Hierarchy


                     TdmodShared.AddTemplateNode
                        TdmodShared.ExpandNode┤ 
                      TdmodShared.SelectNode┤ │ 
                    TfrmDrawers.OpenToNode┘ │ │ 
             TfrmDrawers.ReloadTemplates┤   │ │ 
          TfrmDrawers.sbTemplatesClick┤ │   │ │ 
   TfrmDrawers.ExternalReloadTemplates┘ │   │ │ 
                  TdmodShared.Reload┘   │   │ │ 
    TfrmTemplateEditor.FormDestroy┘     │   │ │ 
         TfrmDrawers.mnuGotoDefaultClick┘   │ │ 
                      TdmodShared.ExpandTree┤ │ 
                             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┘   │ │ 
            TfrmDrawers.tvTemplatesExpanding┤ │ 
      TfrmTemplateEditor.tvPersonalExpanding┤ │ 
        TfrmTemplateEditor.tvSharedExpanding┘ │ 
                   TfrmDrawers.AddTemplateNode┤ 
              TfrmDrawers.ReloadTemplates...┤ │ 
         TfrmDrawers.UpdatePersonalTemplates┘ │ 
      TdmodShared.EncounterLocationChanged┘   │ 
               TdmodShared.AddDrawerTree┘     │ 
                TfrmDrawers.FormCreate┘       │ 
                  TfrmTemplateEditor.InitTrees┘ 
               TfrmTemplateEditor.FormCreate┤   
              TfrmTemplateEditor.RefreshData┘   
        TfrmTemplateEditor.mnuRefreshClick┘     

Calls

Name Declaration Comments
AddChildObject procedure AddChildObject(Owner: TTreeNode); -
TTemplate.GetChildren function GetChildren: TTemplateChildren; -

Called-By

Name Declaration Comments
TfrmDrawers.AddTemplateNode procedure AddTemplateNode(const tmpl: TTemplate; const Owner: TTreeNode = nil); -
TdmodShared.ExpandNode function ExpandNode(Tree: TTreeView; Node: TTreeNode; var EmptyCount: integer; AllowInactive: boolean = FALSE): boolean; -
TfrmTemplateEditor.InitTrees procedure InitTrees; -


Source

154   procedure TdmodShared.AddTemplateNode(Tree: TTreeView; var EmptyCount: integer;
155                                 const tmpl: TTemplate; AllowInactive: boolean = FALSE;
156                                 const Owner: TTreeNode = nil);
157   var
158     Cur, Next: TTreeNode;
159     Done: boolean;
160     NewNode: TTreeNode;
161   
162     procedure AddChildObject(Owner: TTreeNode);
163     begin
164       NewNode := Tree.Items.AddChildObject(Owner, tmpl.PrintName, tmpl);
165       TORTreeNode(NewNode).StringData := tmpl.ID + U + tmpl.PrintName;
166       NewNode.Cut := not tmpl.Active;
167       tmpl.AddNode(NewNode);
168       Done := TRUE;
169     end;
170   
171   begin
172     if((assigned(tmpl)) and ((tmpl.Active) or AllowInactive)) then
173     begin
174       Done := FALSE;
175       NewNode := nil;
176       if(assigned(Owner)) then
177       begin
178         Cur := Owner.GetFirstChild;
179         if(not assigned(Cur)) then
180           AddChildObject(Owner);
181       end
182       else
183       begin
184         Cur := Tree.Items.GetFirstNode;
185         if(not assigned(Cur)) then
186           AddChildObject(nil);
187       end;
188       if(not Done) then
189       begin
190         repeat
191           if(Cur.Data = tmpl) then
192             Done := TRUE
193           else
194           begin
195             Next := Cur.GetNextSibling;
196             if(assigned(Next)) then
197               Cur := Next
198             else
199               AddChildObject(Owner);
200           end;
201         until Done;
202       end;
203       if(assigned(NewNode) and (InEditor or (not tmpl.HideItems)) and 
204                                ((tmpl.Children in [tcActive, tcBoth]) or
205                                ((tmpl.Children <> tcNone) and AllowInactive))) then
206       begin
207         Tree.Items.AddChild(NewNode, EmptyNodeText);
208         inc(EmptyCount);
209       end;
210     end;
211   end;