From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control button in VI doesn't work

Hi, 

when I hit the  Ok button to measure reflection and  mean light intensity in calibration section, I don't get any reaction. It could work perfect before. Although I changed nothing, it doesn't work now. I send the pictures and program attached . I would be very thankful for any suggestion to solve this problem!

0 Kudos
Message 1 of 18
(3,078 Views)

You have multiple event structures in your VI.  That is generally a bad idea, particularly if you don't fully understand how event structures work.

 

I don't understand why you have a mouse up event for buttons.  You should be using the Value Change event for those buttons and putting the button inside the event structure.

 

It's likely that one of your events have been triggered, but the VI is in a state where the event isn't in the path of execution, and then it is configured to lock the front panel until the event case completes.  Is anything else on the front panel dead locked?

 

Read Caveats and Recommendations when Using Events in LabVIEW - LabVIEW 2016 Help

then rethink your architecture as the multiple loops with event structures, particularly loops that appear to be so similar, is a sign of a problematic architecture.

 

Those loops are even set to run forever as they don't ever have a true value going to the stop terminals.

0 Kudos
Message 2 of 18
(3,065 Views)

Dear sir, 

Thanks for reply. Other buttons on the front pannel can work without error. 

0 Kudos
Message 3 of 18
(3,037 Views)

Any chance you disable that button somewhere in your code?

 

Exactly what do you mean by it doens't work?  Does it fail to push down?  Or will it push down, but the action never takes place?

 

Have you used Highlight Execution to see how the code is running?

0 Kudos
Message 4 of 18
(3,033 Views)

Hi Senol,

 

I guess that this is the button and part of your code we are talking about.

 

2019-07-10_09-16-24.png

 

I propose two changes:

  • Move the button's terminal into the Event Structure. LabVIEW updates the button's look only when the terminal is read, which is inside the Event Structure in this case. So automatic "unpressing" of the button will only work when it is in there. Doesn't need to be connected to anything.
  • Change the Event to "Value Change". Mouse up could also fire an event when you press and hold the mouse button "somewhere", then move the cursor onto the button, and release it there. Kind of unexpected for User Interfaces.

Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 5 of 18
(3,005 Views)

As stated before:

Use value change events

Use one event structure

 

Note that mouse up event might do what you want, but it also does things you probably don't want. You can press the mouse outside the button (for instance when grabbing a graph cursor), then release it when hovering above the button. That will trigger the mouse up event, and users (incl. you) will be spooked about it.

 

I'd put a MessageBox in the event. Most of the code is conditional, and I'd want to make sure it's the event that is not triggering, or the code that is skipped because of the conditions... A correctly placed probe would work too.

Message 6 of 18
(2,997 Views)

Button "Kalibrierung für Probe 1 mit Reflexionsgrad" is problematic. When I hit this button it is pushed down but it doesn't take action  Other buttons work well. I moved the button into terminal and changed the event to "value change". But the event still doesn't take action. I put probe on the lines in the events "Kalibrierung für Probe 1 mit Reflexionsgrad", "Kalibrierung für Probe 2 mit Reflexionsgrad " ,  "Messung für unbekannte Probe durchführen" . I get errors on the line in these events. There is something in the program that disables taking action in these events.4.picture.png

0 Kudos
Message 7 of 18
(2,978 Views)

The problem is clear.

 

Note we can't actually run your VI, as subVIs are missing.

0 Kudos
Message 8 of 18
(2,972 Views)

Thanks. What do you prefer to solve the problem?

0 Kudos
Message 9 of 18
(2,969 Views)

Use one event structure.

Use value change events.

Perhaps use the event inspector window for debugging.

 

When I remove all the missing subVIs and IMAQ stuff (don't have it installed), the event seems to work just fine.

0 Kudos
Message 10 of 18
(2,961 Views)