01-12-2017 09:09 PM - edited 01-12-2017 09:10 PM
All I know is this code below works perfectly fine for me. Therefore, there must be something wrong in one of your VIs. My other thought is that you have another reference floating around somewhere that is resetting it.
01-13-2017 12:53 PM
I wrote a program, maybe similar, you can play with. It seems the button did change before the subvi finishes.
Thank you!
@crossrulz wrote:
All I know is this code below works perfectly fine for me. Therefore, there must be something wrong in one of your VIs. My other thought is that you have another reference floating around somewhere that is resetting it.
01-13-2017 01:12 PM - edited 01-13-2017 01:26 PM
If you press cancel, you are changing the value of that button.
XLoop changes to zero because the subVI is called in the next iteration and quits immediately after writing the value property.
01-13-2017 01:27 PM
Thanks. Sorry, I mixed the mechinical latch action, if there possible to hold the button till the subVI finishes?
@altenbach wrote:
If you press cancel, you are changing the value of that button.
01-13-2017 01:29 PM
@binpersonl wrote:
Thanks. Sorry, I mixed the mechinical latch action, if there possible to hold the button till the subVI finishes?
Holding a button is a user interaction. What do you want to happen code-wise if the button is held?
All this seems way to convoluted to solve a simple problem. What is the program actually supposed to do in the end?
01-13-2017 01:40 PM
I want the "Cancel' button not change back so quick and wait till the subvi finished cancellation.
@altenbach wrote:
Holding a button is a user interaction. What do you want to happen code-wise if the button is held?
All this seems way to convoluted to solve a simple problem. What is the program actually supposed to do in the end?
01-13-2017 01:55 PM
binpersonl wrote:I want the "Cancel' button not change back so quick and wait till the subvi finished cancellation.
But it only changes when the user clicks it. And for the subVI to stop, the user much change the value to FALSE. It is not your writing to the property node that is doing that.
01-13-2017 02:04 PM - edited 01-13-2017 02:06 PM
Also note that the exit button gets read in parallel to the subVI execution, thus the loop in the caller will iterate once more (calling the subVI and resetting the XLoop caunter) to read the new value before exit actually takes place.
Why are your numerics orange? They should be integers, right?
Again, there are probably much better ways to do all this. Why so convoluted?
01-13-2017 02:51 PM - edited 01-13-2017 03:01 PM
Could you change the program to a better way? When user click 'start', the loop in subvi runs and output xloop and yloop, when user click 'cancel' (can be the same or another button), the subvi finish calcellation, then the start button is back to default again.
Yes the numeric should be integers.
@altenbach wrote:
Also note that the exit button gets read in parallel to the subVI execution, thus the loop in the caller will iterate once more (calling the subVI and resetting the XLoop caunter) to read the new value before exit actually takes place.
Why are your numerics orange? They should be integers, right?
Again, there are probably much better ways to do all this. Why so convoluted?
01-13-2017 04:30 PM
I don't understand why you even need a subVI? All this could be done in a very simple flat state machine. I assume this is a simplified demo of some more involved code. Can you explain what the purpose is?