LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

printpreviewdialog

Hi,


I want to use printpreviewdialog, but the preview image does not appear.

 

What should I do??

2023-12-21 160922.png

2023-12-21 160900.png

  

0 Kudos
Message 1 of 7
(782 Views)

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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 7
(768 Views)

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.

0 Kudos
Message 3 of 7
(749 Views)

Thank you for the reply.

 

Are there any examples that I can refer to?

 

Or is there an easier way?

0 Kudos
Message 4 of 7
(707 Views)

I haven't tried the print preview dialog (I pick my battles carefully 😎), but here's a FolderBrowseDialog example:

wiebeCARYA_0-1703237079264.png

(Attached in LV13)

0 Kudos
Message 5 of 7
(692 Views)

wiebe@CARYA wrote:

I haven't tried the print preview dialog (I pick my battles carefully 😎), but here's a FolderBrowseDialog example:

wiebeCARYA_0-1703237079264.png

(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)?

0 Kudos
Message 6 of 7
(672 Views)

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! 😀

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 7
(663 Views)