LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use front panel as a button

Hello!

 

Is there any way i can make the whole front panel working as a button? I want to be able to click with the mouse anywhere on the front panel and it should be registerd as a OK click.

 

Best regards blyarn

0 Kudos
Message 1 of 8
(3,439 Views)

You can overlay the entire panel with a transparent boolean.  However, you could not activate any other control bymouse action because they would all be behind the large button.

 

Lynn

0 Kudos
Message 2 of 8
(3,432 Views)

You can use an event structure to capture a "Mouse Down" event anywhere on the front panel.  Treat this as if the user had pressed a button.

 

Capture.PNG



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 3 of 8
(3,431 Views)

Thank you!

 

I have a program that i can run and press a start button. Then in 5-10 seconds a led lights up a counter starts untill a press another button. Then the program tells me how fast i reacted.

If I am supposed to use this Event Structure instead of the buttons, should I put the Event Structure around my whole existing program or what should i do?

 

Best regards!

0 Kudos
Message 4 of 8
(3,424 Views)

For your purpose, I think that 5-10 seconds would be enough time for someone to move the mouse to be over a large button before they need to react to the timer starting.  This would remove the need to make the whole front-panel 'into a button'.

 

An event structure is used to react to front-panel activity (mouse clicks, keyboard key presses, boolean button presses, control value changes, etc) where you don't want to be continuously polling everything until something happens.  This approach may or may not be applicable for your current program (see the first paragraph), but can often be a necessity for larger ones.  Have a look at some of the example vi's provided with your LabVIEW installation if you want to familiarize yourself with event structures and their usage.



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 5 of 8
(3,407 Views)

Yeah, but i want to be able to use the whole front panel as a button instead of the once i got now, if that is possible of course.

I have attached the program with this post if you want to see what i mean.

 

Best regards

0 Kudos
Message 6 of 8
(3,402 Views)

Here, this should do what you want. It is messy and has no error handling/typedefs etc because I'm doing it while I watch football, so I'm not too concerned about my programming practices ;). But basically what it does is, the LED turns on and it tells my even handler loop that it is now on, and it stores the time it turned on in a shift register. Now, the event loop knows that any clicks on the front panel should send a queue message with the time of the button click. So, when the user presses the panel it queues up the time of the button press and in the bottom loop that message i dequeued and the subtraction is done. I know this may be a bit overwhelming with the handshaking so post back if you don't udnerstand anything. The reason I do it this way is because if you queue up a message saying the button was clicked and THEN get the time stamp for the button click once the queue message in the bottom loop is received, you could potentially have some time delay if processing is taking a long time. Then it looks like the button click took longer to happen then it really did. Does that make sense? I'm having a hard time writing it out clearly. Hopefully someone can translate this into english 😉

 

Download All
Message 7 of 8
(3,401 Views)

Thank you very much 😃 That explained a lot!I'll take a closer look to your program later when I have access to a computer with 2011 edition. I just have 2009 on this one :manlol:

0 Kudos
Message 8 of 8
(3,391 Views)