02-25-2009 08:26 AM
Hi,
I have a question about 'wait for front panel activity'. I have multiple controls (push buttons and numerical controls). When I push the 'push button', the 'wait for front panel activity' will cease waiting and run designated code once. However, if I change the value of the numerical controls, the 'wait for front panel activity' will run the designated code multiple times. Please see the attached sample VI. In the sample VI, I have two controls, one is on/off switch of the motor, another is the speed of the motor. The 'Loop Executed Num' counts the number of times the code runs.
My question is, how do I change the setting so that when I change the 'Motor speed setting', the 'wait for front panel activity' generate one event.
Thank you,
Ryan
02-25-2009 08:35 AM
Ryan,
i am not sure why the behaviour is exactly like seen in your attached VI (i'd expect 3 increments if Motor Speed Setting is incremented/decremented).
Nevertheless i'd suggest you to switch to the User Interface Event Handler design pattern provided in the template browser (File >> New).
hope this helps,
Norbert
02-25-2009 08:42 AM
Norbert,
Thanks for your help.
I am using LabVIEW 8.6 base version. I can't find the 'User Interface Event Handler' template. Is this function available in base version?
Thanks,
Ryan
02-25-2009 08:48 AM
RyanWu wrote:I am using LabVIEW 8.6 base version. I can't find the 'User Interface Event Handler' template. Is this function available in base version?
I am afraid that the event structure is not part of the base package. Therefore i'd say the that this template is not provided.
So it seems that you have to stick to the "Wait for Front Panel Activity" including the multiple activity detection or upgrade to at least LabVIEW Full Developement System.....
Norbert
02-25-2009 08:50 AM
Norbert,
Do you have any sample code of the multiple activity detection?
Thanks,
Ryan
02-25-2009 08:59 AM
Ryan,
i found out why the loop executes during editing the numeric control: The blinking of the cursor is considered to be front panel activity.
So it seems to me that front panel activity is defined to be: redrawn (at least a part) of the front panel. This i would call "multiple activity detection" since you changed the numeric value, but receive multiple front panel activities in return...
Norbert
02-25-2009 09:15 AM
Norbert,
That is a interesting finding. I noticed that without changing the value of the control, just use the mouse cursor drag and select the value will cause the program run multiple times. But I failed to link this with the blinking of the mouse cursor. I have to think about how to solve this issue. Currently what I am doing is disabling the change of speed when the motor was runing, i.e., the motor speed setting can only be changed when the motor is not runing. Thus I can avoid sending too much command to the motor while it is running. If you have any suggestions, please feel free to advise.
Thanks,
Ryan