Partager via


SupportsListenerType Method

Specifies whether the ReportListener supports a particular type of report rendering.

? oReportListener.SupportsListenerType(iListenerType)

Parameters

  • iListenerType
    Specifies the type of rendering mechanism for which the ReportListener indicates support.

Return Value

Logical data type.

Returns True (.T.) if the parameter you pass identifies a supported type.

Remarks

Applies To: ReportListener Object.

The ReportListener class will not error if ListenerType is set to a value it does not recognize; it simply provides no output. Your derived classes should follow the same strategy. Implementing SupportsListenerType provides a way to let the user of your class know what your class can handle, without triggering an error.

Classes derived from ReportListener can use this method to eliminate certain forms of natively-supported output from their supported types. For example, you could create a class that requires all page images to be available at the end of the report run, just as Preview does. This class supports only ListenerType values 1 and 3, the two values that allow you to use OutputPage to request page images at the end of the report run. The class returns False (.F.) for the native ListenerType values -1, 0 and 2. These ListenerType values do not cache page images and therefore do not provide the functionality your class needs.

Note

See ListenerType Property for more information about supported and recognized ListenerType values. This topic also has another code example using the SupportsListenerType method.

Classes derived from ReportListener are not required to return True (.T.) for additional values, even if they are registered with additional integer values in the Report Output Application. A class can opt to respect all native ListenerType values (0 through 3), to provide all internally-supported output results, while using its OutputType value, as received from the Report Output Application, to determine an alternative output result.

For example, the ReportListener HTML Foundation Class supports all native ListenerType values and does not add to them. It provides an alternative output result, but does not adjust either its ListenerType value or the SupportsListenerType method. For this reason, you can choose to instruct the HtmlListener to preview or print, using the appropriate ListenerType values, at the same time as it generates HTML. For more information, see OutputType Property (Visual FoxPro).

Example

In the following example, you pass the integer value 99 to an instance of the ReportListener baseclass. You receive a return value of False (.F.) because ReportListener does not support this type. You next pass the integer value 2, and receive a return value of True (.T.), because this is a supported Listenertype.

LOCAL loReportListener
loReportListener = CREATEOBJECT("ReportListener")
? loReportListener.SupportsListenerType(99)
* displays: .F.
? loReportListener.SupportsListenerType(2)
* displays: .T.

See Also

Reference

ReportListener Object

Other Resources

Methods (Visual FoxPro)
Language Reference (Visual FoxPro)
Report Output Application
ReportListener Foundation Classes