MViControl Posted September 24, 2009 Report Share Posted September 24, 2009 Hello, I am thinking to generate a event by code in a vi. e.g. I have a button in vi and I add a "value change" event for it, how can I triger the event by G language in a vi without click the button in front panel? can anybody share the experience? Quote Link to comment
Mark Smith Posted September 24, 2009 Report Share Posted September 24, 2009 Create a property node for the button and use the Value (signaling) property - note that this won't work on booleans with latching behavior Mark Quote Link to comment
Daklu Posted September 24, 2009 Report Share Posted September 24, 2009 You can also use User Events to fire the same event programatically, though that requires a little more supporting framework. Or, if your events correctly issue messages to parallel loops, you can achieve the effect of firing the event by simply sending the command directly to the parallel loop. Quote Link to comment
MViControl Posted September 24, 2009 Author Report Share Posted September 24, 2009 Thanks, the purpose of thinking this is to reuse the code in the event case created before. e.g. I have created code for a button "value change" event, while in other place of vi, I want to programatically fire the event to excute the code in the event. mesmith and Daklu, do you have some simple examples to achive this? Quote Link to comment
smenjoulet Posted September 24, 2009 Report Share Posted September 24, 2009 Thanks, the purpose of thinking this is to reuse the code in the event case created before. e.g. I have created code for a button "value change" event, while in other place of vi, I want to programatically fire the event to excute the code in the event. mesmith and Daklu, do you have some simple examples to achive this? Here are examples of both methods. Of course, in your real program you would want to make sure you do proper error handling and disposal of user events using "Destroy User Event" Scott Sorry, those were in LV 2009. Here they are in LV 8.6 if needed. Trigger Event - Value Signaling.vi Trigger Event - User Events.vi Trigger Event - Value Signaling_LV86.vi Trigger Event - User Events_LV86.vi Quote Link to comment
MViControl Posted September 25, 2009 Author Report Share Posted September 25, 2009 Greate man! The problem been solved based on your guide. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.