04-21-2014 11:17 AM
What is the recommended way for a custom device to delete itself from the system definition?
The scenario I'm working with is this: during my custom device initialization, the user selects a configuration file. If the configuration file is invalid, then I want to give the user the option to pick a new file or cancel the add custom device operation. In this case, the custom device will need to be able to delete itself if the user so chooses. I have tried using the Delete Custom Device Item.vi, but this always gives me an error when the input is the custom device root reference.
Thanks!
04-21-2014 02:54 PM
The error is because the init vi is trying to delete the custom device before the main page has actually been added to the system def tree. The way the engine simulation and sensor simulation custom devices work around this, is instead of the init VI trying to delete the custom device... the init VI just sets a boolean "delete myself" property to true. Then when the main page inits, it checks that property and proceeds to delete itself if true.
That said, in my new designs, I put the browse on the main page instead of the init.
04-21-2014 04:42 PM
Ah, makes sense. Order of operations is important . . .
Thanks Stephen!