01-24-2020 06:39 PM - edited 01-24-2020 07:23 PM
We can add any file as a child to(under) lvclass or lvlib project tree items using Add/File... from a popup menu. But I don't see how to do it with my custom item/file type defined with my own primary provider. Yes, Item_CanDragToProjectWindow is set to always return true in my primary provider. However, I can create an item of my type from the New popup menu for the following items: My Computer, Virtual Folder, lvlib. But I can drag it to a different position within the project tree only under My Computer or on (into) a virtual folder. Not even on(into) lvlib despite I can create it as a New in there!
Will it take somehow modifying the providers for lvclass and lvlib for them to accept my type when it is dropped onto them? Should I create secondary provider for lvlib ({ABC740D6-F254-4BBC-5675-8858F35B820E}) and lvclass ({EFD740D6-F254-4BBC-5675-8858F35B820E}) types? But the main documentation LabVIEW Project Provider.pdf says that "Drag and drop items to and within a project" functionality as well as "Add items to the project tree" can be implemented by primary providers only (page 3).
You can see what I mean if you install the PrimaryProviderExample2, which adds ability to handle html files as a new type. Try to drag an html you have create with that provider and drop it onto lvclass or lvlib. It will not go there even if you always return True from PrimaryProviderExample2_Item_CanDragToProjectWindow.vi
01-25-2020 02:40 PM
I don't see any reasons of why this restriction/limitation is set by NI in the first place. Both lvclass and lvlib are just text (XML) files. Therefore, I can simply edit them and add an item of my new type into them just with a text editor. And then the item will show up in the project tree correctly under (as a child of) the corresponding lvclass or lvlib item. Well, if I drag it out of there later I will not be able to drag and drop it back in without editing the lvclass or lvlib file with a text editor again. Though not critical for my purposes, this is an annoying and unreasonable limitation I would like to know a better workaround for than using Notepad to edit lvclass and lvlib files.