Too much code to fix it all for you, but I can give you some comments;
- In e.g. an event that fires when a button value changes, do not read the button by wiring to the terminal, read the value from the NewVal terminal of the event case. The button may no longer have the value that it had when the event fired...
- You do not really need to set the canceled value to false in all the events, you leave the terminal to default in all the cases except the one for the cancel button...again, read the button using the NewVal.
- The "EditPerformed" indicator can as the code is now be set to true and then falsely set to false again if the user hits the edit button multiple times, but cancels the edit tha last time...(you still want to flag the previous changes don't
you?). You can fix this by only changing the flag if the flag is to be set to true...(use a case). OR use a shift register and only change the value of the shift register if it really should change...(are you familiar with the use of shift registers?).
- When you read or set values do it by wire (if necessary use a shift register to hold the current value), if you can't do it by wire...use locals, not the value property. In this case it's all user interface and simple controls/indicators so it's not that bad...but as a general rule avoid using the value property, it's the most inefficient way of doing it memory and speed-wise. Using a wire or shift register prevents race conditions though...that might be an issue here, haven't studied the code well enough to see those though.