I have started programming in LabVIEW about 3 months ago, so I am pretty new to that.
For now I am programming on a custom device and in this program I am adding sections and channels to this custom device in the system definition file. This works fine, but I can delete this sections and channels with the delete button and this is the problem.
Is it possible to disable the delete button in the system definition file and how does this work?
So there's a few things you could try here.
In the LabVIEW, VeriStand System Explorer Pallete (NI VeriStand -> Custom Device API -> System Explorer functions), there are two VIs, Disable Dynamic Buttons and Enable Dynamic Buttons, which might do what you want though I don't know for sure as I have never used them myself. However, these may only work for custom buttons not standard built in ones such as the Delete button.
Perhaps a better alternative though is the <DeleteProtection> custom device XML tag described here:
I don't believe there is a way to set this using the VeriStand LabVIEW VIs, it would have to be manually added to the custom device XML file. the embedded data logger that ships with VeriStand uses this tag in several places so you could look at its custom device XML to see how it is used.
the Enable/Disable Dynamic Button is, how you said, not the solution for my problem, because it is only for customized buttons.
The <DeleteProtection> tag is very useful, but when I tried it, only the Custom Device was protected from deleting. I could still delete
the sections and paths.
I have found an alternative solution, even though this is not a very good solution. I modified the RT Driver Main.vi, that the sections and channels are checked, when deploying. If they exist, deploy, if not then stop deploying and give the user a message. This works fine, but how I said, there is a better solution.
If you think there is a better way to solve the problem, please give me feedback.
I still thank you for your help!
To add this tag to channel/section, you would need to create a new page in the custom device XML and add the <DeleteProtection> tag to it.
Then when you create your channels/section using the create channel/section VI, use this custom page's GUID rather than the default.
I have found a good example with ActionVIs where the pages are written in the xml file. I think it is the same principe as the <DeleteProtection>.
The thing is I do not know how many pages I need because the sections and channels are created dynamically when pressing a button.
I can not write this pages in the xml file because I do not know how many pages I need.
To add this on runtime to the xml file is not possible because I can not just recompile my project during runtime.
So I think this is not possible or am I wrong with this?
You should still be able to use that tag even with the dynamic page creation. The custom device XML is more like a template of pages. So if you wanted to dynamically create "N" copies of "Page A", you still could.
For example you could add you custom device in the system explorer and on the main page have a button and a numeric control which would dynamically add new pages to the custom device tree when the button was pressed.
All you would do is use a for loop to call the Create Section and Create Channel VIs X number of times.
I attached a custom device which demonstrates this, it's 2017