by XenoG » 07 Dec 2017 20:13
Replying so that Google can provide the answer to me (and others) when I next forget how to do this. Many thanks to Jorge for supplying the information needed solve the problem of allowing clients to download images of the TIWCGJQPlot object.
1. Create an image (myIWCGJQImage) in a region (myIWCGJQRegion).
2. Set the image's visible property to false (myIWCGJQImage->Visible = false;)
3. Set the region's RenderInvisibleControls property to true (myIWCGJQRegion->Visible = true;)
4. After you create your plot (myIWCGJQPlot), assign the plot's image to the myIWCGJQImage using
myIWCGJQPlot->ChartToImage(myIWCGJQImage);
5.Use RenderRegionAsync(myIWCGJQRegion, rramLazyLoadMethod, true); to update the region. This will render the myIWCGJQPlot and paint to the invisible myIWCGJQImage.
6. Add a button for the client to download the image from the myIWCGJQPlot.
7. Add an IWTimer with a 1 second interval and set enabled to false.
8. On the button click, save the image in myIWCGJQImage to the server (myIWCGJQImage->SaveImage(tempDownloadFileName);) and then start the timer.
9. Use the event myIWCGJQImageAfterSave (event of TIWCGJQImage) to store in memory the name of the file that has been saved to the server (downloadFileName). You will need this filename in the timer event.
10.In the timer event, disable the timer, then use a TIWCGJQFileDownload object to download the filename that was stored in step #9. (myIWCGJQFileDownload->DownloadFileName(downloadFileName);). Finally, set the downloadFileName to NULL (empty string).
I hope the Delphi people can decode this from the C++ notation.