ActiveX - Printing a Daisy Chart


One of the main uses of Daisy working under control of another program is to print Daisy Charts of data in the background.

This is done for example in the Daisy Example Viewer using the third button in the stack.

Daisy Example Viewer - Click for Large

The simplified code from the Viewer corresponding to the Print button is shown :-

    Dim wrkError As String
    Dim wrkPath As String
    Dim wrkTemplate As String
'
'  Setup the menus, toolbars and status
    Daisy.miniHelpVisible = True
    Daisy.MenuRightClickEnabled = False
    Daisy.MenuEnabled = False
    Daisy.ToolbarMainVisible = False
    Daisy.StatusVisible = False
'
'  Setup chart size
    Daisy.ChartSize = dsxPrinterPortrait
'
'   Load the database
    wrkPath = ...
    If (Daisy.LoadDatabaseCSV(wrkPath, wrkError) = False) Then
        Daisy.MessageError wrkError
        Daisy.UnloadDaisy
        Set Daisy = Nothing
        Exit Sub
    End If
'
'  Load the template and draw the Daisy Chart
    wrkTemplate = ...
    If (Daisy.LoadTemplate(wrkTemplate, True, wrkError) = False) Then
        Daisy.MessageError wrkError
        Daisy.UnloadDaisy
        Set Daisy = Nothing
        Exit Sub
    End If
'
'  Print Chart
    Daisy.MenuPrintChart
    Daisy.MenuDatabaseClose
    Daisy.UnloadDaisy
    Set Daisy = Nothing
    ...

Note :-

  1. The menus and toolbar are disabled and the status is hidden first.

  2. The chart size is set to portrait. A high-resolution setting which gives better printing is also available.

  3. The database and the template to be used are then loaded using the LoadDatabaseCSV and LoadTemplate methods.

  4. MenuPrintChart is then used to actually print the Daisy Chart.

  5. Finally, the 'Daisy' object is closed and set to Nothing.

  6. Note that ShowDaisy is NOT called in this code. This means that Daisy runs in the background.


ActiveX   Daisy   Index