11-22-2012 03:54 AM
Hi
I created a control definition and used it in several places in my code.
I then refactored it by changing part of a cluster from a numeric to a string, this then broke the application because the change was not propagated through out the application.
If the change was automatically updated by labview in a similar fashion to the interactive find/replace method which visual studio uses then my change would not have broken my application.
Does lab view have a feature to aid refactoring?
Where are the vi's getting the definition for the old version of the control? is it stored in the vi itself? if so what is the purpose of using control definitions if we are not able to update the definition and have that change automatically propogated to places it is used in.
Solved! Go to Solution.
11-22-2012 04:00 AM
11-22-2012 04:10 AM
In addition, if you change the datatype of the type definition, a lot of code might get broken because it is wired to functions that expect a different datatype. For example, if that numeric was wired to a numeric indicator, you cannot simply wire a string to it and expect it not to break.
Can you be a bit more specific what you are changing. Maybe attach a small example?
11-22-2012 05:06 AM
Thanks to you both
I was not worried about the change in data type due to the polymorphic inputs on things like comparisons and array indexing primitives.
I did change the control to a strict def type and then to test the funcitonality I added another string to the structure. This extra string was not added in the places in the rest of the code where the type definition was used.
is this normal behaviour? I would have expected the extra string to be added to every reference to the control "strict type def".
11-22-2012 05:45 AM
Hi Jacob,
did you create those other instances of the control from the (strict) typedefnition or did you create them from the (simple) control definition?
When created from type definition they will adapt to changes of that definition!
11-22-2012 05:51 AM
OK Thanks
I was not aware that I needed to press the apply changes button in addition to saving the type def.
thanks again for help with the basics 🙂