12-21-2023 01:12 AM
Hi,
I want to use printpreviewdialog, but the preview image does not appear.
What should I do??
12-21-2023 02:36 AM - edited 12-21-2023 02:40 AM
That is not gonna work like that. The Print Preview Dialog class expects the application to retrieve the preview area of the dialog and then draw its document in there. However, LabVIEW has no idea about your .Net dialog and won't just draw its document in there for you to look at. Doing this correctly is not only non-trivial but very complicated.
Basically you would need to hack into the LabVIEW Print Report Excel class to retrieve the document property of the Excel application and then assign that to the Document property of the Print Preview Dialog. And likely a few dozen other things to make it all work properly.
12-21-2023 03:22 AM
All those .net dialogs need the VI that starts them to run in UI thread.
If the VI that starts the .net dialog doesn't run in UI thread (see VI Properties, Execution) LV often simply hangs.
Of course, also Rolf's advice... I used the .net folder browser dialog, not the print preview dialog.
12-21-2023 11:13 PM
Thank you for the reply.
Are there any examples that I can refer to?
Or is there an easier way?
12-22-2023 03:27 AM - edited 12-22-2023 03:27 AM
I haven't tried the print preview dialog (I pick my battles carefully 😎), but here's a FolderBrowseDialog example:
(Attached in LV13)
12-22-2023 09:50 AM
wiebe@CARYA wrote:
I haven't tried the print preview dialog (I pick my battles carefully 😎), but here's a FolderBrowseDialog example:
(Attached in LV13)
Is there a way to have it check whether it's running in the UI thread (so you can throw an appropriate error)?
12-22-2023 12:43 PM - edited 12-22-2023 12:50 PM
Not in the way you describe it. Instead you write a Vi and assign it to run in the UI thread in the VI Properties. And add a diagram comment: Do not change the VI execution system if you want your program not to lock up when calling this VI! 😀