LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to revert any changes to a cluster containing 256 boolean elements

Solved!
Go to solution

Hello ! i have a cluster containing 256 boolean elements , which i am using as checkboxes for my application. I want to add cancel button functionality to my application, so that when i click the cancel button, all the changes that i have done on the checkboxes revert or goes back to previous state. Can u please tell me how can i implement this ?

0 Kudos
Message 1 of 9
(2,794 Views)
Solution
Accepted by topic author shaunmarsh123

@shaunmarsh123 wrote:

Hello ! i have a cluster containing 256 boolean elements , which i am using as checkboxes for my application. I want to add cancel button functionality to my application, so that when i click the cancel button, all the changes that i have done on the checkboxes revert or goes back to previous state. Can u please tell me how can i implement this ?


Use a Functional Global Variable to perform Read/Write actions, see snippet below. You can just store the actual cluster state inside this FGV, and when the user selects "cancel" in the corresponding Event case, read out the previous content of the FGV, and use a Local Variable of your cluster in write mode, to revert back to the prev state...

 

By the way, to use such monstrous cluster seems a bit counter-productive. I would use a 2D array of Boolean+text clusters, much more scaleable and you can easily access array elements. Much better than what you do now... See example here: https://forums.ni.com/t5/LabVIEW/Create-checkboxes-programmatically/td-p/3664192

 

FGV_cluster_storage_BD_read.pngFGV_cluster_storage_BDwrite.png

 

 

0 Kudos
Message 2 of 9
(2,779 Views)

Write back to the control via a local variable.

 

To make all FALSE, do a "AND FALSE".

To make all TRUE, do a "OR TRUE".

 

(boolean operations with a single diagram constant)

Message 3 of 9
(2,775 Views)

@altenbach wrote:

Write back to the control via a local variable.

 


Here's a very simple demo.

 

SetClearAll.png

 

 

0 Kudos
Message 4 of 9
(2,770 Views)

@altenbach wrote:

@altenbach wrote:

Write back to the control via a local variable.

 


Here's a very simple demo.

 

 


You forgot the question was about a "cancel" or "revert back changes" functionality. But using your VI, the OP can easily implement the required option (or using the FGV I showed, or a shift register in my main while loop...).

 

 

Message 5 of 9
(2,756 Views)

Blokk wrote

Use a Functional Global Variable to perform Read/Write actions, see snippet below. You can just store the actual cluster state inside this FGV, and when the user selects "cancel" in the corresponding Event case, read out the previous content of the FGV, and use a Local Variable of your cluster in write mode, to revert back to the prev state...

 

By the way, to use such monstrous cluster seems a bit counter-productive. I would use a 2D array of Boolean+text clusters, much more scaleable and you can easily access array elements. Much better than what you do now... See example here: https://forums.ni.com/t5/LabVIEW/Create-checkboxes-programmatically/td-p/3664192

 


 To add to that idea, the AE/FGV could have an array of clusters internally. That way each change adds to an array and each cancel/undo removes the last element. It'd be a nice feature. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 9
(2,742 Views)

@Blokk wrote:

u forgot the question was about a "cancel" or "revert back changes" functionality. But using your VI, the OP can easily implement the required option (or using the FGV I showed, or a shift register in my main while loop...)

Yes, I did not quite understand that part. "Previous state" makes sense if this is e.g. a dialog subVI, but I could not tell from the question alone. Yes, for the [cancel] implementation, we would need to store the initial state unless it is all e.g. guaranteed to be all FALSE. Should it otherwise remember the state between calls or is the "Previous state" an input to the dialog?

0 Kudos
Message 7 of 9
(2,734 Views)

i will be using this VI as a sub vi and it will be used as a popup window. As soon as it pops up based on a decision from the main VI , then ,if i make any changes to the checkboxes , and then if i press cancel button , then those changes must be reverted back. Lets suppose when i called the checkbox window ,there were 2 checkboxes ticked(state 1) , and now i tick 3 more checkboxes(state 2) but press cancel button. On pressing the cancel button, my pop up window must close and any changes made in this call must be reverted back.Now, when i call this pop up window again , then i must see 2 checkboxes selected (state 1), since all the changes made in my last call were reverted back due to pressing of cancel button. 

0 Kudos
Message 8 of 9
(2,732 Views)

That's pretty standard. Just split/remember the incoming cluster, and on cancel you send/rewrite that one.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 9
(2,703 Views)