LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Enable all buttons in cluster programatically

Solved!
Go to solution

Hello,

I have a sub VI that takes accepts a Boolean for if it is the first time this Sub VI is run based on conditions of the Main VI.  If it is the first time that the sub VI is run (incoming Boolean = TRUE) I want the cluster of buttons to all be enabled.  One of the functions of this sub VI is to disable the buttons as certain actions are completed by the user.  However, I have found that if the user completes the necessary tasks, stops the main VI (as intended once they are finished with the program) and then starts the main VI up again, when they go into this sub VI on the 2nd run, the same buttons are disabled from their 1st run.  I have attached a sample code that replicates the issue along with 2 attempts I have tried at fixing it, re-initializing all values in the sub VI, which doesn't work because an enabled state isn't a value that can be reset to its default, and enabling the cluster, which doesn't enable all of the buttons within the cluster.

 

Any help that can be provided is much appreciated.

0 Kudos
Message 1 of 7
(2,838 Views)
Solution
Accepted by topic author ryancam

Why do you even need a boolean control if we have this function? 😄

 

To enable all cluster elements, you need to iterate over them, e.g. as follows:

 

ClusterElementsEnable.png

Message 2 of 7
(2,835 Views)

I didn't know that first call function existed.  Thanks for that and the solution to what I was originally asking!

0 Kudos
Message 3 of 7
(2,827 Views)

@altenbach wrote:

Why do you even need a boolean control if we have this function? 😄

 

To enable all cluster elements, you need to iterate over them, e.g. as follows:

 

ClusterElementsEnable.png


I've never used the "First Call" function before (although I've known about it for a very long time).  What would you use it for?  Seems like natural dataflow always took care of those issues for me.

 

Just like once I was asked if I ever used a semaphore before; I confessed I never felt the urge to.  That person got snooty and said that you can't be a true LabVIEW programmer if you never used one before.  I always thought that if you planned everything out carefully, you didn't need to use one.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 7
(2,711 Views)

I am using it as the input to a case structure, if it is the first time the sub VI is called, then I want the sub VI to reinitialize everything back to its defaults.  Throughout the course of the sub VI's use, some of the buttons on my boolean cluster get disabled and the boolean text is populated with a numeric value for future calls to this sub VI during the same run of the main VI.  So if the incoming value to that case structure from the "First Run" call is false, I want the sub VI to hang on to the disabled buttons and the boolean text that they have been assigned.

0 Kudos
Message 5 of 7
(2,702 Views)

@billko wrote: 

I've never used the "First Call" function before (although I've known about it for a very long time).  What would you use it for?  Seems like natural dataflow always took care of those issues for me.


A very common use can be found inside all ptbypt function that have an "initialize" terminal (examples). Each reentrant instance needs to initialize if that terminal is true OR unconditionally on first call.

 

Often action engines using shift registers need to initialize the shift registers on first call (they cannot be initialize shift registers, because, they need to retain data between calls!). However, these days I use feedback nodes instead, because they have a global initialization option that makes "first call?" no longer needed.

0 Kudos
Message 6 of 7
(2,692 Views)

@altenbach wrote:

@billko wrote: 

I've never used the "First Call" function before (although I've known about it for a very long time).  What would you use it for?  Seems like natural dataflow always took care of those issues for me.


A very common use can be found inside all ptbypt function that have an "initialize" terminal (examples). Each reentrant instance needs to initialize if that terminal is true OR unconditionally on first call.

 

Often action engines using shift registers need to initialize the shift registers on first call (they cannot be initialize shift registers, because, they need to retain data between calls!). However, these days I use feedback nodes instead, because they have a global initialization option that makes "first call?" no longer needed.


LOL - it's my coding style that precludes me from using it, I see.  In the case of the A/E that you pointed out, I would have explicitly made an init state that I would call before I actually needed it.  But I now see that it means an extra step.  If I used "First Call", I could skip that init step.  Always learning - and that is EXACTLY why I asked.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 7 of 7
(2,684 Views)