graastein Posted November 21, 2006 Report Share Posted November 21, 2006 Hello I need to disable multiple controls on my vi when an event occurs, I'm currently using this code: Add all the references to an array and use a for loop to disable via property node. The problem is that this gives me a "disable-wave". From one side of the vi to the other, clearly visible. Cool effect, but not planned Is there a better way? Quote Link to comment
LAVA 1.0 Content Posted November 21, 2006 Report Share Posted November 21, 2006 Is there a better way? Have you tried disabling front panel updates before starting to disbale controls and turning updates back on after you have disabled them all? Quote Link to comment
ned Posted November 21, 2006 Report Share Posted November 21, 2006 The problem is that this gives me a "disable-wave". From one side of the vi to the other, clearly visible. Cool effect, but not planned Is there a better way? The way you're doing it is just fine. Surround your for loop with enabling and disabling the front panel property "Defer Panel Updates" as shown below. All the controls will be disabled simultaneously when you disable "Defer Panel Updates" at the end of the loop. Quote Link to comment
LAVA 1.0 Content Posted November 21, 2006 Report Share Posted November 21, 2006 Oops... a repost. Quote Link to comment
graastein Posted November 21, 2006 Author Report Share Posted November 21, 2006 Have you tried disabling front panel updates before starting to disbale controls and turning updates back on after you have disabled them all? This worked great :thumbup: ned: This is the way I did it Thanks Quote Link to comment
jaegen Posted November 21, 2006 Report Share Posted November 21, 2006 Some further info: Rather than "manually" getting a reference to all those controls, you might want to look into using the "Controls[]" property for your VI's front panel: Of course, since you probably don't want to disable everything, you'll need some logic around when to write a "2" and when to write a "0". Also, it's probably more efficient to get all the references at startup, and store them in a shift register or something, rather than building your great big array every time the event fires. Good luck, Jaegen Quote Link to comment
graastein Posted November 21, 2006 Author Report Share Posted November 21, 2006 Some further info:Rather than "manually" getting a reference to all those controls, you might want to look into using the "Controls[]" property for your VI's front panel: Of course, since you probably don't want to disable everything, you'll need some logic around when to write a "2" and when to write a "0". Also, it's probably more efficient to get all the references at startup, and store them in a shift register or something, rather than building your great big array every time the event fires. Good luck, Jaegen I actually knew this, but I did not think about a way not to disable all controls. But that was not very difficult to do. This is my new code, a lot cleaner (Made infotext for newbies like myself.) Quote Link to comment
Chris Davis Posted November 22, 2006 Report Share Posted November 22, 2006 This VI is almost the same as yours, but more reusable. You'll have to add the Defer panel updates since you are doing lots of controls. Enjoy. Quote Link to comment
Aitor Solar Posted November 22, 2006 Report Share Posted November 22, 2006 Of course, since you probably don't want to disable everything, you'll need some logic around when to write a "2" and when to write a "0". For this logic, I've found useful to group the controls that must be enabled / disabled and apply the changes to the whole group elements. This way is not necessary to check all the front panel objects and it doesn't depend on the labels either. Saludos, Aitor 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.