Oxetta Callback Reports
When building a report, any reporting engine needs a source for the information that will be printed in the report. Unlike many reporting engines that can receive this information from databases only, Oxetta is also able to get this information directly from your C/C++ application thru a callback function. When an Application calls Oxetta to print or preview a report, it can provide Oxetta with that callback function, and Oxetta will launch that function every time it needs to print something or make a decision.
Oxetta callback function prototypes are described in the OXETTA.H header file as:
ANSI version: int PASCAL __stdcall function-name(char* szBand, char* szElement, char* szValue, void** ppParam);
UNICODE version: int PASCAL __stdcall function-name(WCHAR* szBand, WCHAR* szElement, WCHAR* szValue, void** ppParam);
When Oxetta needs the calling application to provide it with any information, it calls this callback function, passing in the function parameters:
- szBand: the name of the report band Oxetta needs information for, or NULL in the case that this information is required for entire report
- szElement: the name of the report element (e.g. text box) Oxetta needs information for, or NULL in the case that this information is required for an entire report band
- szValue: the 1024-characters buffer used to receive information passed from the calling application to Oxetta
- ppParam: a pointer-to-pointer parameter that can be used by the calling application to store certain information between callback function calls. Oxetta does not use this parameter by itself but passes the same pointer in all calls of the callback function so the calling application can use it for it's own needs
Oxetta calls the callback function in the following cases:
- Oxetta needs to know if it should print a certain report band. In this case, Oxetta passes the name of the band in the 1rst callback function parameter and NULL in the 2nd and 3rd parameters. The callback function should return 1 if Oxetta should print the band and 0 otherwize
- Oxetta needs to know what to print in a certain Text Box element. In this case, Oxetta passes the name of the band this Text Box element belongs to in the 1rst callback function parameter, the name of the element in the 2nd parameter and the text currently assigned to the element in the 3rd parameter. Oxetta expects that callback function will possibly change the text that needs to be printed and put the new element text in the 3rd parameter; to store that text Oxetta reserves 1024 characters (ANSI characters in ANSI version and wide characters in UNICODE version) in the 3rd callback function parameter. Callback function return value is ignored in this case.
- Oxetta asks the application for a value of a certain report parameter. This issue is discussed here.
For an example of Oxetta callback function usage please refer the Sample application included into Oxetta installation.
Next article: Print Report Function
Oxetta documentation: Documentation Index