LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to make a file viewer

I am trying to make a program which allows the user to select a file and display it on the screen in LabVIEW 6.1. My problem is that the Picture control seems to hold the previous as well as the current pictures. I am new to using image applications in LabVIEW and cannot find a way to erase the image (if I send an empty image it just goes into the rotation).

Can anyone offer some suggestions?
0 Kudos
Message 1 of 8
(3,128 Views)
John,

This is not extremely straight-forward.

(1) You can take a look at the OpenG Application Builder <> installer which registers .bld files with a VB Script that invokes LabVIEW's ActiveX server. If you are building an EXE you would need to alter the VB Script to connect to the ActiveX server in your EXE.

(2) You can invoke you application with a command-line and use WinAPI calls to get the command-line arguments. Check out this project for an example of getting the command-line that launched LabVIEW: <> You will need to register your application to recieve the command-line from the windows shell by registering your extensions, as is done in the OGAB installer.

At OpenG, there are
a few of us who are working together on tools to make this a lot easier. We will eventually include them into the OGAB so that file registration and handling can be automatically added to an application that you are building.

Good luck,

-Jim
0 Kudos
Message 2 of 8
(3,128 Views)
I'm not sure if this is what you mean, but attached is a small example program demonstrating the effect of the "Erase First" Property.

If you run the vi with Erase true, toggling the top switch between runs results in either one or two circles being drawn. If you set Erase to false, the drawing will always show two circles, regardless of the position of the top switch, or more accurately, any new drawing is simply layered on top of what's already there.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 8
(3,128 Views)
Sorry, I posted to above answer to the wrong thread...
0 Kudos
Message 4 of 8
(3,128 Views)
I am using the Erase First property in my vi but still it does not seem to erase. I have attached a simplified version of the viewer for review. As I loop through selecting different pictures (jpg files) the picture doesn't remain with the current one but loops through all previously viewed pictures as well.
0 Kudos
Message 5 of 8
(3,128 Views)
Look at what is happening in your loop. In the example you posted you are re-drawing the jpeg every loop iteration, even if the user hasn't changed the selection. You should only update the picture when the user changes something. If you're using 6.1 the Event Structure is very nice for this. Otherwise, use a shift register to see if the user changed something.

Attached is an example. The directory query is still in the loop, but the picture only gets written to when a change is made. Your example had a vi "analyze image" which I do not have, so you'll see a change to make it work.


Aside from unecessarily updating the picture each loop iteration, your example seemed to work ok for me.

Hope this helps.

Tim
0 Kudos
Message 6 of 8
(3,128 Views)
Can you repost this code in 6.0 format. I'll be glad to look at it for you.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 8
(3,128 Views)
There was a problem with the Analyze image vi. This has been corrected now and everything is working fine.

Thanks for the help.

John
0 Kudos
Message 8 of 8
(3,128 Views)