LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView Picture on button

Hello, I am just starting my adventure with LabView hence my question.
How do I make it so that when I press a button specifically in this case Square LED, it shows some specific picture? I am making something like a Restaurant Menu, I would like when I click a dish to order it to show a picture of it, is it possible to get this on Square LED or not though?
Greetings and thanks in advance

0 Kudos
Message 1 of 7
(1,383 Views)

Well, yes, though typically a "Square LED" is an "Indicator" meaning you would use it as a data output, not something that you click on.  Usually you would want something that is visually designed to appear clickable (button, switch, etc.)

 

Anyway, to trigger it you would want to use an event structure.  See here for example:

https://www.ni.com/en/support/documentation/supplemental/06/event-driven-programming-in-labview.html

There's also code examples in your LabVIEW install, follow the directions on that page to get to them.

 

For showing the picture, do you need the ability to load the picture from a file or can you just put the a picture in your code and show that?  Loading from a file is more complicated.

0 Kudos
Message 2 of 7
(1,371 Views)

I created something like this:
https://ibb.co/gwWFFXY
And it works, it loads the image from the folder, however every time I fire up the program I have to enter the path to the file again. So if it's a more difficult option to choose to begin with, the option with dropping the image into the code and showing it would suffice.

0 Kudos
Message 3 of 7
(1,345 Views)

You can use a flat square button and customize it to show different pictures for the false and true state. (DETAILS)

 

If you make it a control instead of an indicator, you can just click on it to flip between the two pictures (one could be blank), no code needed at all.

 

 

(ALSO: Please do not link to external sites riddled with advertisements and popups, you can embed images right in the forum posts, or even attach VIs if you want)

0 Kudos
Message 4 of 7
(1,328 Views)

You can make the path as a constant (or read from a ini file) so you don't have to insert the path everytime. 

 

To change the image of  a boolean check this other post 

programatically change button image - NI Community

 

0 Kudos
Message 5 of 7
(1,284 Views)

An even simpler way would be to customize the button so the TRIE state is transparent, then paste the image as background in the front panel underneath.

Now you only need one customized button. You can even place it inside an array or cluster container (transparent container background) and have an entire row or column of such buttons, covering a long imager strip containing a series of image tiles.

0 Kudos
Message 6 of 7
(1,279 Views)

@altenbach wrote:

An even simpler way would be to customize the button so the TRIE state is transparent, then paste the image as background in the front panel underneath.


Here's how that could look like. No code needed at all!

 

altenbach_0-1686322683993.png

 

0 Kudos
Message 7 of 7
(1,273 Views)