03-25-2009 07:02 AM
Dear all,
I writing a program which has 5 clusters and all the clusters contain a "STOP" button. the program can exit when any of the button is pressed.
when i press the button the value of the button goes to False and remains False. I want it to get back to True. so i tried using the "value property" and putting the value "False".
but it still remains True.
I am using event structure to notice the value change. and have put "Stop value change" of all the buttons in a single event.
How can i change the value of the button to False ??
Thanks,
Ritesh
Solved! Go to Solution.
03-25-2009 07:08 AM - edited 03-25-2009 07:09 AM
HI
Can you upload your VI so we can debug this problem
Regards
Santosh
03-25-2009 07:13 AM
03-25-2009 07:14 AM
Ritesh
Make sure the cluster control(s) are in the event handling the boolean change event.
03-25-2009 07:22 AM
03-25-2009 07:38 AM
ritesh024 wrote:Dear all,
I writing a program which has 5 clusters and all the clusters contain a "STOP" button. the program can exit when any of the button is pressed.
when i press the button the value of the button goes to False and remains False. I want it to get back to True. so i tried using the "value property" and putting the value "False". but it still remains True.
I am using event structure to notice the value change. and have put "Stop value change" of all the buttons in a single event.
How can i change the value of the button to False ??
I have somequestions to understand why you want to implement your code in such a way.
If I understand correctly, you want the program to stop and completely exit if any of the 5 stop buttons is pushed. You probably have your reasons for having 5 buttons but if you could explain, it would help to understand the scenario. Back to stopping and exiting the program. When you click any of the 5 stop button, does something have to happen (get triggered) before the program exits? other than the normal course of execution of the program.. When you mention that pressing the button gives you False, then did you reverse the logic of the button? Because usually, when you press a button, you get TRUE. Then you mention that you try to use a property node to force the value to False, but it remains True.. I'm confused. It may be the selected mechanical action that you have selected for the buttons. Can you clearly explain what you are trying to achieve?
As for using Local Variables in the posted example, I have no clue as to why that is necessary. If the program is to exit, then let it do so. Select the appropriate mechanical action for the buttons and handle whatever needs to be handled so that the program exits gracefully. Try using the mechanical action "Latch When Released" and stay away from Local Variables (that's what wires are for... to wire directly).
R
03-25-2009 07:55 AM
By "Exit", he may mean "Stop " in which case, returning the Stop button(s) to False is a common procedure.
Latch When Released may not work correctly, visually, with an event structure. The button may not "bounce back", depending on how your case structure is made and where the controls are.
I think writing False to a Stop button whose Action is not latched is a proper and extremely common use of a Local variable. A wire will not work. (Well, if we want to get fancy, we could use references and wires).
03-25-2009 08:07 AM
Hi
I am extremely sorry for creating some confusion regarding the True/False state of the button.
the Button turns True when pressed and remains True. i want to set it to False again when it is pressed.
i am creating an application which has 5 different Front panels, and i am using Tab control to switch from one FP to another. And on each FP i am giving a Stop button to Close the application.
Its not that i am having only Stop button in the cluster. There are other buttons also which do some job. so when those buttons are pressed the behavior remains the same. they don't switch back to False and neither "Value property" node works.
Ritesh
03-25-2009 08:36 AM
Broken Arrow:
For the latch mechanism to work, the terminal must be read inside the appropiate event.
Ritesh:
But the question is, how are you clustering buttons over several tab-pages? Iguess you got something wired weird. Maybe we could help more with code and/or screenshot.
Felix
03-25-2009 09:20 AM
A simpler solution is to have your Tab with the 5 different screens and to the right (or left / top / bottom), you would have all your common controls that you wish to have access when you're in any of the the Tabs. That way a single stop button is needed.
Typically, with a event structure, you have a Queue or Notifier to pass data to another loop that actually does the work. The event structure loop would be to respond to operator selections. There are other architectures, but let's keep it simple. By using a Queueyou can send information as well as run status (run / stop / exit). And doing so, you would not rely on Local Variables which may introduce a race condition depending on how they are implemented within your program.
R