Working Principle

The print and design methods of the OCX Control implement a standardized print loop, which can be used directly with most of the simple applications (applications working with only one table). To print multiple tables, a separate print loop is used (see chapter Printing Relational Data). In the case of this method, the data is passed within the events CmndDefineVariables and CmndDefineFields to List & Label. This allows any data source to be connected individually. The event arguments allow access to useful information such as user data that has been copied, the Design mode etc. The property pbLastRecord is used to notify the print loop that the last data record has been reached. As long as this is not the case, each event is invoked repeatedly in order to retrieve the data.

The Design method shows the Designer in a modal pop-up window on top of your application window.

You can specify additional options in the CmndSetPrintOptions event. Internally, this event is triggered after invoking LlPrintWithBoxStart() but before the actual printing.

One very simple implementation of the print method looks like this:

Private Sub ListLabel1_CmndDefineVariables(ByVal nUserData As Long, ByVal bDummy As Long, pnProgressInPerc As Long, pbLastRecord As Long)

 

 Dim i As Integer

 

 For i = 0 To Recordset.Fields.Count - 1

 

   Select Recordset.Fields(i).Type

    Case 3, 4, 6, 7: para = LL_NUMERIC: content$ = Recordset.Fields(i)

    Case 8: para = LL_DATE_MS: a! = CDate(Recordset.Fields(i)): content$ = a!:

    Case 1: para = LL_BOOLEAN: content$ = Recordset.Fields(i)

    Case Else: para = LL_TEXT: content$ = Recordset.Fields(i)

   End Select

  

   nRet = LL.LlDefineVariableExt(Recordset.Fields(i).Name, content$, para)

 Next i

 

 If bDummy = 0 Then

   pnProgressInPerc = Form1.Data1.Recordset.PercentPosition

   Recordset.MoveNext

 End If

End Sub