LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Image control- setting images conditionally

 

Hello All!

 

I am a Labview newbe and I need help with image control. I have a set of two images- one static png and one animated gif.  I want to use these two images as an activity indicator in a picture box or other control.  I can send one or the other to the picture box programmatically in the function block screen but I do not understand how to set the image control conditionally for condition "A" and condition "B". The code below is for two separate picture boxes.  My goal is to select one image to show in a single box depending on conditions "A" or "B". The two conditions are "not running" and "running". Can this be accomplished with boolean logic?   I also hope to use such a control in the future for multiple conditions to help illustrate to the user a specific hardware item to pay attention to. I am using LV 2014 on a Windows 7 box. The built VI will be used on Windows 7 and XP. 

 

FB.png

FP.png

 

-cmengineer

0 Kudos
Message 1 of 11
(4,016 Views)
  1. Please don't post pictures of your VIs -- post the VIs themselves (either as attachments or as Snippets) so that we can look at each of the components and check out the wiring, and even try to execute them ourselves to discover what happens.
  2. I can't test it, but I would not expect the Read PNG File function to work properly with a GIF input.
  3. I don't understand the basic question you are asking.  It sounds like you are asking if you can use a boolean to choose between executing two sets of code.  I assume you know about a Case Statement, so what is the real question?

Bob Schor

 

 

0 Kudos
Message 2 of 11
(3,996 Views)

Hi cmengineer,

 

It sounds like you may be talking about a case structure. Take a look at this link and see if it will work for your project.  If not, can you please explain your end goal in more detail?

Briana P.
Licensing
Sr SW Engineering Manager | NI R&D
ni.com/support
0 Kudos
Message 3 of 11
(3,962 Views)

Hi CMEngineer,

 

There are many ways to select the path you'd like. You can drag a path constant into an array constant to create an array of paths, then index out the one you want. You can also use selectors or case structures.

0 Kudos
Message 4 of 11
(3,952 Views)

Sorry, Bob.  I really am "that new".  I will post the vi. 

0 Kudos
Message 5 of 11
(3,902 Views)

Hey, we were all Newbies at one time!  And you are trying to do some interesting things with LabVIEW -- we're here to encourage you.

 

Bob Schor

0 Kudos
Message 6 of 11
(3,891 Views)

Thank you Briana.  Yes, I did try the case structure shortly after posting the question.  I am sure that this is the correct method.  What was odd is that I did not seem to get the effect of changing the image as a result of the bool flag I used.  It may be that a GIF cannot be used in this fashion with a PNG .  If this is the case (no pun intended) how can I utilize static png images and animated gifs to indicate activity? When I try to run the vi, I do get error 6 regarding the File I/O error at this section of the code.

 

I am attempting to recreate a program which I created in VB.net some time ago. 

0 Kudos
Message 7 of 11
(3,883 Views)

All,

 

Attached is the vi.  I did not attach the the other associated files. I do not know if I should package them in a zip file.  The forum has a limit of three files per post.

 

-cmengineer

0 Kudos
Message 8 of 11
(3,870 Views)

@cmengineer wrote:

All,

 

Attached is the vi.  I did not attach the the other associated files. I do not know if I should package them in a zip file.  The forum has a limit of three files per post.

 

-cmengineer


Yep, bundling them into a ZIP file is how you do it.

 

Some questions and comments:

  • What is the "object" on your Front Panel that seems to show a moving progress bar?  When I try to examine it, it identifies itself as "object".  I find it intriguing that it "moves" even while the code is just being viewed.
  • In my earlier post, I mentioned that I didn't think you could wire a .GIF into the Read PNG function, yet you are still doing it.  Does this, in fact, work?
  • If you can post an example of the .PNG and .GIF functions that you are trying to visualize, we could "play" with them ...

Bob Schor

0 Kudos
Message 9 of 11
(3,843 Views)

Happy Sunday Evening All!

 

 

I have included all files in the zip file.  I changed the image for one state to a jpeg and changed the control to a jpeg control.  This works to demonstrate the state change but my goal is to use the gif which is shown as decoration in the middle of the vi front panel as the running state indicator.

 

Now that I have tested it, I think I need to work on the file write operation as well.  Instead of getting my four points of data in a row, I get one or another.  Always fun!

 

-cmengineer

0 Kudos
Message 10 of 11
(3,818 Views)