Wednesday, August 5, 2009

Write Your Own Quick Drop Keyboard Shortcuts in LabVIEW 2009

I've always thought it would be great to define my own editor operations that occur when a certain key combination is pressed. Unfortunately, every single key combination, from Ctrl-A to Ctrl-Z, is currently taken by some operation in the LabVIEW editor. During LabVIEW 2009 development, I spoke to some of my colleagues in LabVIEW R&D to see how hard it would be to allow users to override default key combinations in LabVIEW with their own G-based features. Turns out it would be pretty tough to modify the LabVIEW editor in this manner, and nobody seemed to think it could be done anytime soon.

So I took matters into my own hands and did the next best thing I could think of, which was to define some key combinations that would perform certain editor operations while Quick Drop was visible. Once you've pressed Ctrl-Space, you're in my world now. :) So in LabVIEW 2009, there are three key combinations that I've defined:
  • Ctrl-[shift]-D - If you select some diagram objects, then press Ctrl-Space-Ctrl-D, controls and indicators will be automatically created and wired for all inputs and outputs of the selected objects. If you press Ctrl-Space-Ctrl-Shift-D, constants will be created and wired for all inputs.
  • Ctrl-R - If you select some diagram objects, then press Ctrl-Space-Ctrl-R, those objects will be removed from the diagram, but all wires that had pass-through inputs and outputs on those objects (like refnum or error wires) will be retained.
  • Ctrl-T - If you press Ctrl-Space-Ctrl-T while a diagram is open, the labels of all control/indicator terminals on the top-level diagram are moved the left/right of the terminal, respectively.
But wait, there's more! I designed this feature with everybody in mind, knowing that you might want to create your own Quick Drop shortcuts, or maybe you want to replace mine with something better. So yes, Quick Drop keyboard shortcuts are a plugin architecture, and you are free to use LabVIEW Scripting to write your own shortcuts! You'll notice that the following folder now exists in LabVIEW 2009:

[LabVIEW 2009]\resource\dialog\QuickDrop\plugins

Inside this folder are,, and Those are the VIs that define the Ctrl-[shift]-D, Ctrl-R, and Ctrl-T shortcuts in Quick Drop. If you want to write your own shortcut (let's say it's Ctrl-E), start with resource\dialog\QuickDrop\QuickDrop Plugin, save it as in the plugins folder, and now you have a Ctrl-Space-Ctrl-E shortcut!

As I get time in the coming months, I plan on posting new shortcuts to the NI Community that I didn't quite have time to squeeze into the LabVIEW 2009 release.


  1. Awesome! Thanks for this.

  2. Again... Nice work! I can't wait to start using the new tools as soon as zou upgrades the G and Image Toolboxes!

  3. I like it. How will this work when we create our own shortcuts, and then with newer releases of LabVIEW, more shortcuts are available with potentially the same keystrokes?

    Can you recommend some keystrokes that NI will leave as user-defined?

  4. As things are right now, you would need to reassign either your shortcut or the NI shortcut to a different key if future LabVIEW versions include shortcuts that you've already defined. This reassignment would only require renaming the .vi file. I'm investigating ways to address this in future LabVIEW versions, like allowing you to name the shortcut VI whatever you want, then having a text file or something that maps keys to VIs. But even that would have possible conflict issues, so I'm still trying to figure it out...

    Oh, and to answer your first question, The keys that either already have an assignment, or I have an idea of a feature to assign to them, are D, Q, B, T, S, R, I, P, N, A, and E. I would also recommend avoiding X, C, and V, as Ctrl-X, Ctrl-C, and Ctrl-V could potentially be used to cut, copy, or paste text in the Quick Drop text box.

  5. Doesn't work for me. I downloaded your vis and installed to my 2009 directory as directed. With an object selected, Ctrl-Space-Ctrl-D and Ctrl-Space-Ctrl-space-D gives me a "Data Cache Size" object.

  6. I replied to the comment thread on the NI Community entry where you posted the same question here.

  7. Hi Darren,

    I just saw Stephen Mercer give a demo of scripting at NI Dev Days yesterday.

    I've downloaded, installed and activated the API. But the new quick drop shortcuts are not working for me. I also do not see the plugins subfolder in the Quickdrop folder.

    I am using LV 8.6.1 So I suspect this is the problem. Although I thought scripting would work with this version of LV as well.

    Is this a LV 2009+ only thing?

  8. Hi Patrick,

    I introduced the Quick Drop feature in LabVIEW 8.6, but Quick Drop Keyboard Shortcuts are only available in LabVIEW 2009 and later. If you're looking for a way to get your feet wet with scripting, I'm pretty sure the JKI Right-Click Framework is available in LabVIEW 8.6. Whereas Quick Drop Keyboard Shortcuts give you a way to write your own editor features tied to keyboard operations, the right-click framework lets you write your own features tied to right-click menu options.