Jump to content

Disable multiple controls on vi.


Recommended Posts

Hello

I need to disable multiple controls on my vi when an event occurs, I'm currently using this code:

post-3560-1164123927.png?width=400

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 :rolleyes:

Is there a better way?

Link to comment
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 :rolleyes:

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.

post-3989-1164124787.gif?width=400

Link to comment

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:

post-932-1164127971.png?width=400

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

Link to comment
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 ;)

post-3560-1164135344.png?width=400

(Made infotext for newbies like myself.)

Link to comment
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.

post-1450-1164184003.jpg?width=400

Saludos,

Aitor

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.