10-27-2019 10:47 AM
I want the area of the screen to be assigned to a button. When you click that area of the image it will push the button.
  pixel area that if you click inside it will create a Boolean True.
			
    
	
		
		
		10-27-2019
	
		
		11:14 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 - last edited on 
    
	
		
		
		05-04-2025
	
		
		06:28 PM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 by 
				
		![]() Content Cleaner
		
			Content Cleaner
		
		
		
		
		
		
		
		
	
			
		
You don't give sufficient information, but there are many possibilities.
10-27-2019 11:24 AM
You have several requirements:
You do not say what happens if the Boolean value is already True -- this is something you might consider. You also do not say anything about the timing of the Mouse Down action and the switching of the Boolean, another thing you might want to consider.
The most straight-forward way I can think to do this (which requires the minimal amount of "LabVIEW Magic" to pull off) is to employ a Rectangular Boolean Control (something that looks like the "Stop" button). In fact, let's start with a Stop Button. Place the Stop button on the Front Panel and size/move it so that it "covers" the area you want to make into your "switch". Now all that you have to do is to make the button be "invisible". Controls have a bunch of Properties, one of which is "Visible" -- if you set Visible to False, the button will not be Visible (duh!), but you can't "press" an "Invisible button!
But there's another way -- make it transparent! Right-click the Control and bring up Properties. Right-click the On Color, which brings down a Color Chart. In the upper-right corner, there's a little box with "T" (for Transparent). Select it. Now do the same for the Off Color (no pun intended), and look at your Button. All you should be able to see is the label, STOP. So uncheck "Show Boolean Text". You now have a working, but transparent (and thus not visible) Button.
Note that the Square Buttons in LabVIEW have a default "Latch When Released" Mechanical Action. You need to decide if this is the behavior you want for your "button".
Bob Schor
10-27-2019 01:26 PM - edited 10-27-2019 01:37 PM
Found it..
it's fantastic you can size the box to any size and it that's the new area.. click inside and LED turns on.. exactly what I wanted
10-27-2019 01:43 PM - edited 10-27-2019 02:27 PM
There are many things "wrong" with the "solution" that you found, not the least that it is extremely idiosyncratic, is easily "broken" (try deleting, then un-deleting, the Decoration that defines the bounding box), and seems to require an additional "visible" rectangular object (in this case, a decoration). If any novice LabVIEW readers follow this Post, I recommend trying my method first.
Bob Schor
10-27-2019 02:41 PM
@Bob_Schor wrote:
There are many things "wrong" with the "solution" that you found...
b..bu...but the example is "NI verified"! 😮
Seriously, I agree with Bob here. It is clumsy and pointless to use such a poorly scalable solution! (and why is there a vestigial timeout event???)
10-27-2019 03:03 PM - edited 10-27-2019 03:13 PM
Here's a quick example along my mentioned ideas. Modify as needed.
(Arguably simpler than the example referenced earlier 🐵
10-28-2019 05:53 AM
Correct me if I'm wrong here, but you just turned my picture into a button? it's no longer using a bounding box.
10-28-2019 07:51 AM
@nrcan wrote:
I want the area of the screen to be assigned to a button. When you click that area of the image it will push the button.
pixel area that if you click inside it will create a Boolean True.
I have done that quite a few times and it amounts first keeping track of the bonds of your "sweet spots" in the image and figuring out which of the sweet spots is closest to the mouse down location.
In this post in Picture Control thread, I included a link to some code that populated a picture control with an arbitrary set of images and tracking which inserted image the mouse is over.
If your objects are rectangular the checks amount to comparing if the mouse location is above the bottom below the top to the right of the left and to the left of the right.
If your object are not square then calculating the closest center to the mouse position can help.
Now if you objects are concave or over-lapping then life gets interesting. I will leave that for an exercise to the reader.
Ben
10-28-2019 10:17 AM
@nrcan wrote:
Correct me if I'm wrong here, but you just turned my picture into a button? it's no longer using a bounding box.
Yes, that's the simplest way. (or use a transparent button)