Partager via


ListenerType Property

Specifies the type of report output the ReportListener produces.

ReportListener.ListenerType [= iExpr]

Return Value

Integer data type.

The following table lists the values recognized by Visual FoxPro natively.

Native ListenerType Output Result

-1

(Default) This is the base state of the abstract ReportListener native class. It produces no output.

0

The ReportListener renders output page by page, sending rendering events to a printer driver.

1

The ReportListener renders all pages, and then makes the output pages available to a new Xbase component stored in _REPORTPREVIEW. This ListenerType takes no action if there is no _REPORTPREVIEW object available.

2

The ReportListener renders output page by page, but does not send it to a printer. You can use the output by writing code in the OutputPage method, which is invoked as each page is produced.

3

The ReportListener renders all pages at once, and does not explicitly call _REPORTPREVIEW. You can use the output by writing code after the report run, calling OutputPage to instruct the ReportListener to send a page to your chosen target device.

The Report Output Application adds some user-defined rendering results to the native set above. However, using these values do not prevent you from receiving native Visual FoxPro output results simultaneously from the same ReportListener object, according to the native ListenerType values above. For more information, see OutputType Property (Visual FoxPro).

Call Report Output Application with Output Result

4

The ReportListener provides an XML file as output. By default, its ListenerType is -1 (no native output). You can also set its ListenerType property to one of the natively supported values, for two types of output at once.

5

The ReportListener provides an HTML file, and optional subsidiary image files, as output. By default, its ListenerType is -1 (no native output). You can also set its ListenerType property to one of the natively supported values, for two types of output at once.

Remarks

Applies To: ReportListener Object.

The Report Engine provides a ListenerType value to the Report Output Application when you use the OBJECT TYPE <N> clause on a REPORT FORM command, or when you SET REPORTBEHAVIOR 90, indicating that you want to use object-assisted reporting for all REPORT FORM commands. Report Output Application maintains a registry for default ReportListener classes to handle the native ListenerType values, as well as the two additional OutputType values added by its own Visual Foxpro class library and any others that you nominate. For more information, see Report Output Application.

Your derived ReportListener classes can handle multiple types of output results by supporting multiple ListenerType values. You can use the SupportsListenerType method to evaluate the ListenerType property during a report run, and determine whether your derived class should take action.

You can register a single class as the default handler for multiple types of output results with Report Output Application. Report Output Application assigns the value it receives from the Report Engine to a companion property of your ReportListener-derived object, OutputType. Your class can dynamically determine the correct ListenerType value to use, based on the OutputType it receives and its own capabilities to handle different output results.

For example, Report Output Application provides UpdateListener, the ReportListener User Feedback Foundation Class, as the default handler for multiple native ListenerType values. When initialized, UpdateListener has a ListenerType of -1 (no output). It checks OutputType to determine which ListenerType it should have for each REPORT FORM command you execute.

Example

The following code comes from the OutputType_assign method of the ReportListener Base Foundation Class, the class from which UpdateListener descends. The code checks to see if the value received as OutputType is one of the ListenerType values the class supports, and assigns the value to ListenerType if it is.

IF THIS.SupportsListenerType(THIS.OutputType)
   THIS.ListenerType = THIS.OutputType
ENDIF

See Also

Reference

ReportListener Object Properties, Methods, and Events
REPORT FORM Command

Other Resources

Properties (Visual FoxPro)
Language Reference (Visual FoxPro)
ReportListener Foundation Classes