Adopt a Palette!
Ho-ho-ho. Unfortunately I'm not going to offer your a magic palette that contains AI functions that code for you. Well, not this year. However, I think it's time for some tips about palettes. Those are totally forgotten by the mere human coders. It's for the best, as a handful of LabVIEW devs created tools that build and distribute palettes for you (think VIPM...). However, let's get back to some manual work to discover how you can punctually use them for the best.
<user.lib> Is A Bad Iceberg
A quick way to add a new function/control palette is to copy your LabVIEW files to the <user.lib> folder. This folder automatically synchronizes with your LabVIEW palettes so no other action than a LabVIEW reboot is required. However, <user.lib> has its downsides : by default, ALL the files will be shown in the palettes.
A palette should be like an iceberg. It can be massive, even dangerous, but if you can only see the pretty and enjoyable/usable part of it, you're fine. As such, <user.lib> is a very extraverted iceberg. However, you can make it more modest by inserting leading underscores into the file names here and there to hide unwanted functions/controls.
For instance, my (pretty) fresh install of LabVIEW shows this, and you can tell what's included in the palette from there. Of course the underscore trick is recursive.
Templates Are One Click Away
If you want to manually edit your palettes, the interface is not particularly friendly and you shall be patient, but you can go to Tools>Advanced>Edit Palette Set. From there, you can browse your palettes, rearrange them, and of course add new palettes (for functions, from a VI, a *.llb library, a palette attached to a *.lvlib, from a folder...) Look at the help if you're confused with the options.
Because I still strongly recommend a tool like VIPM in order to build a full palette, let's focus on the simpler and more legitimate case where I only want to add one VI to an existing palette:
- Make sure your VI has a decent icon.
- Move it to a common location (like LabVIEW Data in <My Documents>)
- Open the palette editor. I'm going to add my VI to the existing Structures subpalette.
- Right-click an open cell in the palette, and add your VI!
- That's not just it. In my case, I want the content of my VI to be dropped on the diagram when I use it, not the icon:
(Don't ask me about the two options below Place VI Contents, they're quite new and have never managed to make them work yet...)
Good APIs include examples and templates. AMC or the JKI State Machine are good illustrations where you have an entry in the palette that you can use to drop a complete architecture to get you started. Be a good API/palette designer too!
In my case, I decided to pimp the event structure so it natively has the dynamic events terminal, and added a default event (Front Panel Closed? with Discard? enabled). This way, you have a fully usable structure that replaces the tenacious Stop button. Combine it with a quick drop shortcut (like, 'E' ?) and you're getting one stop closer to Darren, Mathias and the other speedy LabVIEW developers!
Oh, and don't forget to (carefully) use InternalPaletteEdit=True in LabVIEW.ini if you know what you're doing (don't yell at me if you screw your native palettes) so you don't have to copy palette files around!
Very last tip before the Xmas meal. Did you know you could rearrange palettes ? You want "Data Communication" to be right below the Programming palette? Sure thing. Just make the function palette persistent (visible in its own window), then you'll see two small vertical bars next to the expand/collapse arrow that allow you to grab the palette and move it somewhere else.