ActiveX - Templates
Daisy Charts are often generated from templates either directly loaded into the program or selected with MenuGetTemplate.
Examples of LoadTemplate were shown in Drawing a Daisy Chart and Printing a Daisy Chart.
The actual code snippet is repeated :-
Dim wrkError As String
Dim wrkTemplate as String
...
wrkTemplate = ...
If (Daisy.LoadTemplate(wrkTemplate, True, wrkError) = False) Then
Daisy.MessageError wrkError
Exit Sub
End If
...
This will load the template and draw a chart.
MenuGetTemplate just calls the dialog box and then draws the chart, if a template is selected.
Template Modification
In many cases the template is not to be used as is, but only after a small modification. A selection might be changed for example.
Daisy has several methods that can be used to copy and modify templates before they are loaded and used to draw charts.
It is not recommended that mapping fields and aggregations are added to the template as these have a large number of parameters. However simple modifications can be made using FileWriteProfileString.
The code snippet below shows the cloning of a template to a temporary file and the changing of the select.
Dim wrkError As String
Dim wrkTemplate as String
Dim wrkNewTemplate as String
...
wrkTemplate = ...
wrkNewTemplate = Daisy.CloneTemplate(wrkTemplate, "", "New Name", _
"", wrkError)
If (wrkNewTemplate = "") Then
Daisy.MessageError wrkError
Exit Sub
End If
if (Daisy.SetTemplateSelect(wrkNewTemplate, "Value", "10000", _
"30000") = False) Then
Daisy.MessageError wrkError
Exit Sub
End If
If (Daisy.LoadTemplate(wrkNewTemplate, True, wrkError) = False) Then
Daisy.MessageError wrkError
Exit Sub
End If
...
If (Daisy.FileKill(wrkNewTemplate,wrkError) = False) Then
Daisy.MessageError wrkError
Exit Sub
End If
Note :-
The method returns the path of the new template and this is blank if the clone was unsuccesful.