OnClick Event
BJL
Brussels, Belgium
FR304 and BCB6
In some reports, I use the OnClick event to close the Preview, change the dataset and re-prepare the report, all under a single click.
In Fr 254, to close the preview, I have used successfully the following code, looping through the components to find the address of the PreviewForm.
<span style='font-family:Courier'> for (int i = frReport1->ComponentCount - 1; i >=0; i--)
{
if (dynamic_cast<TfrPreviewForm*>(frReport1->Components))
{
dynamic_cast<TForm*>(frReport1->Components)->Hide();
dynamic_cast<TForm*>(frReport1->Components)->Close();
}
}</span>
In FR 3, however, the compiler stops on the line
<span style='font-family:Courier'> if (dynamic_cast<TfrxPreviewForm*>(frxReport1->Components))</span>
with a message requesting a type name, as if TfrxPreviewForm was not defined.
Is there a different way to handle the code in FR3? Is there a better way to close the Preview from within the OnClick event?
Thank you for helping.
BJL
In some reports, I use the OnClick event to close the Preview, change the dataset and re-prepare the report, all under a single click.
In Fr 254, to close the preview, I have used successfully the following code, looping through the components to find the address of the PreviewForm.
<span style='font-family:Courier'> for (int i = frReport1->ComponentCount - 1; i >=0; i--)
{
if (dynamic_cast<TfrPreviewForm*>(frReport1->Components))
{
dynamic_cast<TForm*>(frReport1->Components)->Hide();
dynamic_cast<TForm*>(frReport1->Components)->Close();
}
}</span>
In FR 3, however, the compiler stops on the line
<span style='font-family:Courier'> if (dynamic_cast<TfrxPreviewForm*>(frxReport1->Components))</span>
with a message requesting a type name, as if TfrxPreviewForm was not defined.
Is there a different way to handle the code in FR3? Is there a better way to close the Preview from within the OnClick event?
Thank you for helping.
BJL
Comments
TForm(Report.Preview.Parent).Close;
The BCB equivalent code
<span style='font-family:Courier'> dynamic_cast<TForm*>(frxReport1->Preview->Parent)->Close();</span>
works, but after that the newly prepared report does not stay on screen. It closes without stopping at the ShowPreparedReport.
Is it a flag to restore?
BJL
tz@fast-report.com