Quick Drop Enthusiasts

cancel
Showing results for 
Search instead for 
Did you mean: 

Quick Drop Plugin: Align selected elements

A LabVIEW Quick-Drop (QD) plug-in for aligning and distributing elements on afrontpanel or blockdiagram.

This plug-in is based on the existing Align & Compress BD/FP Objects plug-in. The plug-in is completely refactored and changes the handling and the keymap of the original plug-in.

 

Thanks to Jim for his incredible plug-in.

 

Screenshot

 

The design idea behind the usage of the plug-in is to simply handle the alignment using the left hand on the keyboard and the WSAD keys. Therefore you will be very fast to organize your elements on the VI.

Installation

The plug-in is published as a VIPM Community package. Search for QuickDrop AlignElements in the VI Package Manager and install it easily. 

https://www.vipm.io/package/mnprojects_lib_quickdrop_alignelements/ 

Usage

At first you have to select some elements either on the fronpanel or the blockdiagram of the VI.

The Quick Drop plug-in uses the default shortcut A.

There are three possible ways to act with the plug-in using the mouse or only the keyboard.

 

Using the mouse

With the mouse you can simply act with the plugin

Firstly press CTRL+SPACE to open the quick drop dialog, then press CTRL+A to open the plug-in dialog containing the alignment and distribution buttons. The different buttons can be pressed to move the objects.

At the end the dialog can be closed by clicking on the close button in the corner or by pressing the ESC key.

 

Using the mouse

 

Using the keyboard

A faster way to handle this Quick Drop plug-in is by using the keyboard.

 

After selecting some elements press CTRL+SPACE and CTRL+A to open the dialog window. Afterwards you can use one of the following keys to execute the wanted alignment:

  • W: Top
  • S: Bottom
  • A: Left
  • D: Right
  • C: Horizontal Center
  • V: Vertical Center
  • Q: Vertical Gap
  • E: Horizontal Gap

After pressing a key for alignment the panel will immediatelly be closed.

 

Using the keyboard

 

If you move the mouse pointer over one of the buttons you will see the shortcuts for each operation. (Only some of the distribution elements can be controlled by key.)

 

Using the keyboard

 

Using the Quick Drop combo box

The last option to handle the plugin is based on Darren's suggestions.

After selecting some elements open the Quick Drop dialog by pressing CTRL+SPACE. Insert one or more of the above characters into the combo box. Then press CTRL+A. The plug-in will immediatelly execute the alignment or distribution of the elements.

 

Using the combo box

 

 

On of my favorites is to open the Quick Drop with CTRL+SPACE. Then insert AQ into the combo box and press CTRL+A. This will align the elements to the left and distribute it with an equal vertical gap. I use this to arrange the VI input and output elements on the blockdiagram.

 

Using the combo box

Numeric controls on the frontpanel

Like the original plug-in the increment and decrement buttons of a numeric control will be hidden during alignment (based on this idea exchange).

By default this behavior is activated. It is possible to deactivate it in the LabVIEW.ini.

Quick Drop Options

You can control certain aspects of operation of this plug-in by setting the following LabVIEW.ini tokens:

Token Default Value Description
QDAlignElements.HideIncDec True Hide Inc/Dec buttons of Numeric Controls during alignment.

Hints

The plug-in is developed in LabVIEW 2017. 

 

The source code of the project can be found on Github.

If you find some bugs, have questions or other comments please feel free to reply.

 

Message 1 of 7
(3,505 Views)

Uhhh yeah I always wanted to have this !

Okay I though about coding this with the arrow-keys but with WASD-keys one can do it with only one hand.

Perfect 😉

CLA
0 Kudos
Message 2 of 7
(3,369 Views)

I've been thinking for years that I should write this plug-in, but I never got around to it. Nice work! Here are some changes I suggest making (here's a screenshot that illustrates some of them):

align_changes.png

  1. Since you have the W/A/S/D/C/V shortcuts for common alignment operations, I think it would be useful to just be able to type those in the Quick Drop window itself, that way the user doesn't even have to see the pop-up dialog. So with the change shown above (note the use of the Combo Box Text.Text property), I can select controls, Ctrl-Space, type 'A', Ctrl-S, and it will do the left-align without even showing your dialog.
  2. If you end up making that change, you'll want to have a subVI that you can call both in the Align Elements.vi and in the pop-up dialog VI as well. Right now, that code is duplicated in my implementation.
  3. You don't need to close the Panel and Diagram references, since they inherit from GObject. More info about when you do and don't need to close references is in my Brainless LabVIEW presentation.
  4. You should typedef the enum that defines the alignment operations.
  5. You can use case-insensitive matching on the case structures so you don't need to duplicate the upper and lower case keys.
  6. If the scripting code errors out, you'll want to call the Transaction.Fail method, and not wire its error in.

Again, nice work. I think I'll be using this plugin a lot.

Message 3 of 7
(3,344 Views)

Hy Darren,

 

thank you for your tips and the link to your presentation. It will improve my code. I've added your requested feature with the combo box to the plug-in.

 

Will it be possible to add this plug-in to the List of Community Quick Drop Keyboard Shortcuts?

 

Martin

Message 4 of 7
(2,838 Views)

Will it be possible to add this plug-in to the List of Community Quick Drop Keyboard Shortcuts?

 

Done, and I love the latest changes!

Message 5 of 7
(2,823 Views)

Hey guys,

 

Let me just start by saying how grateful I am for this tool. It has saved me a TON of time cleaning up garbage BDs and FPs, and of course when creating new ones. That being said, there is some behavior that doesn't quite match up to the behavior when clicking the built-in align and distribute buttons.

 

I've noticed basically the entire time using it that for numeric controls on the FP, the left align operation doesn't take into account the increment/decrement button (IDB hereafter). Well after cleaning up like 50 FPs this morning, I finally decided to delve into the code to figure out why. It appears as though it is an intended behavior, even though it doesn't match up to the built-in left align button's behavior. Before the alignment starts, you hide all IDBs on selected numeric controls, and after the operation completes you show them all. Which is fine; it is your tool and we are just lucky enough to have it. 

 

What might not have been intended (and what prompted me to actually write this), is that if you do any sort of A&D operation on numeric controls, once the operation completes even the ones that previously did not have the IDB visible now do.

 

It's an easy fix; I'll probably just remove the code in red so it works better for me personally. But I'm curious. Why hide IDBs on numerics before the operation and show them after?

 

Spoiler
Untitled.png

 

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 6 of 7
(2,050 Views)

Hy Redhawk,

 

I'm glad to see that my plug-in is in use and also helps others.

 

I took the behavior of the Inc/Dec buttons from the original plug-in.

 

After your inputs I published a new version of the package and I hope the new release will be available soon on VIPM.

With the current version 1.1.0.3 I fixed the bug that the Inc/Dec buttons of all numeric controls are added after the alignment. So if a inc/dec was hidden before the alignment it will also be hidden after it.

I also add the option to disable this behavior with an entry in the LabView.ini.

 

Take a look at the Github page for instructions: https://github.com/matrixx567/LabView_QuickDrop_AlignElements

 

Thank you for your inputs. It helps to improve the plug-in.

 

Greets,

Martin

Message 7 of 7
(2,017 Views)