08-22-2013 06:30 AM
I'm sure everyone is familiar with LabVIEW's ability to the related palette when you right click on a block diagram function or terminal, right? For example, drop an Equal? primitive down and then right click it, you see the Comparison Palette and Boolean Palette are ready in the menu. Or drop Basic Function Generator.vi and right click, and LabVIEW provides quick access to the Waveform Generation Palette.
I have a toolkit which incorporates some XControls. When dropped onto the front panel, the terminal is of the datatype used in the XControl. This happens to be a custom datatype for my toolkit, which is a Data Value Reference pointing to a custom class. Now, when I right click my terminal I get immediate access to the Memory Control Palette (which is where one would handle Data Value References) - but this is exactly the opposite of what I want! I want the developers of my toolkit to be able to access the various VIs I provide to handle the DVR sensibly. Therefore this needs to point to my own palette of VIs that are distributed with the toolkit.
So, how do we configure this? Is it automatic? How does LabVIEW go about determining which palettes are associated with VIs, functions and custom datatypes?
Solved! Go to Solution.
08-22-2013 06:58 AM
In a class (or a library), you can select the default palette in the properties (on Page General) after the menu file (.mnu) is added to the class. This palette is shown when rightclicking on a wire of the class.
But the palette is not shown for DVR containing the class.
Could maybe the XControl return the class which contains the data in a DVR?
08-22-2013 08:10 AM
shb wrote:
In a class (or a library), you can select the default palette in the properties (on Page General) after the menu file (.mnu) is added to the class. This palette is shown when rightclicking on a wire of the class.
But the palette is not shown for DVR containing the class.
Could maybe the XControl return the class which contains the data in a DVR?
The common datatype used throughout the toolkit is the DVR, the content itself is sensitive and ideally wouldn't be handled by the developer, so I must always use the DVR for the XControl datatype.
If using DVR always causes the memory palette to be shown, am I therefore stuck here?
08-22-2013 08:50 AM
Why don't you wrap your DVR in a class?
This way you can also control access to your DVR reference or do your users need direct access to the DVR?
08-22-2013 08:56 AM
Karsten van Zwol wrote:
Why don't you wrap your DVR in a class?
This way you can also control access to your DVR reference or do your users need direct access to the DVR?
Is that also what you were suggested shb?
It's an interesting thought, a class wrapping a DVR of my class...
08-22-2013 09:50 AM
Thoric,
I was going to suggest the same thing, wrap your DVR in a class. This has also the added benefit that if for whatever reason you ever change your mind about using a DVR it won't break your users code, because they would have been using the object it also does not give them the temptation to attempt to wire that DVR into a in place structure.
Regards,
Fab
08-22-2013 07:29 PM
Thoric,
As I know, you could create a library (.lvlib) file, add all your VIs and the palette (.mnu) file to this library then set the default palette as the palette file you added.
08-23-2013 03:23 AM
08-26-2013 03:55 PM
There's no way to get this to work for the wire type. Since you can't do operations directly on the DVR for any of the types inside the DVR, the DVR doesn't automatically display its contained type's palette. We've never added a second palette to the LV class to specify "this is the palette to show if I am inside a DVR".
08-26-2013 04:31 PM
Thanks Aristos.
I think, based on Fab's sensible maintainability advice, I will be moving to using a further custom class used purely for containing the DVR in it's private data, create a bunch of wrapper calls to the existing methods, and take advantage of the 'default palette' feature of the class library settings.
My only issue at the moment is that I use VIPM to build and install my palette for me, therefore it doesn't exist in my development environment and it's not available for selection. I can't install the toolkit into my dev env, that would be a cross-linking nightmare, so now I'm learning to create my own palettes, which is a little less fun that I'd hoped.