LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Weekly Nugget 04/20/2009

Today's nugget deals with Front Panel object grouping and locking.  When you group objects together on the front panel and select one of the objects, the group gets a yellow selection border around them to show they are grouped:

 

 

 

You can also lock front panel objects.  In this case, they get a gray selection border around them:

 

 

 

The only difference that I've seen between grouping and locking is that, with grouped objects, you can select one object and drag the entire group around to reposition it.  With locked objects, you cannot select or move any of the objects.  To select the locked group of objects, you have to drag a box around them to highlight them.  Personally, I have found that grouping has met all of my needs...I've never had to lock objects.  Over the years, I have found the following three benefits to grouping front panel objects:

  1. If you arrange some objects on your panel in a certain way relative to each other, and you want to make sure their position relative to each other never changes, you can group them.  This also makes it easy to move them together as a group.  Some developers would use a cluster for this purpose, but I generally prefer to use clusters for data organization, and not as organizational elements on a user-visible front panel. 
  2. In a similar fashion, if you have a group of controls whose position relative to each other you want to remain unchanged when the panel is resized (and there is a resizable object on the panel), you can group or lock those controls.  For examples of this behavior, check out Tools > Profile > VI Metrics or Tools > LLB Manager.  Both of these dialogs have a large list item that resizes when you resize the front panel, but all the other controls are grouped so their positions relative to each other do not change when the window is resized.
  3. This is a minor issue, but it's actually the first reason I ever found to use grouping.  If you move a control on top of (but not inside of) another control on the front panel, you see a shadow underneath, indicating that the controls are overlapping.  Thankfully, the shadow doesn't appear when the VI is running.  Nevertheless, I found the shadow to be distracting on a UI I was working on.  So I grouped the controls that were overlapping, and the shadow disappeared.  You can see this behavior in the VI Analyzer UI (Tools > VI Analyzer > Analyze VIs).  The Back/Next/Save/Close/Help buttons all overlap a hidden Tab Control, but they don't reside within the Tab Control.  I have them grouped so that, when I'm working on the VI Analyzer, I don't have to see the shadow.
Are there any other cool uses for grouping/locking out there?
Message Edited by Darren on 04-20-2009 11:17 AM
Download All
Message 1 of 7
(6,536 Views)

Thanks for the Nugget Darren.

 

Always very informative.  Good topic.

 

R

0 Kudos
Message 2 of 7
(6,528 Views)
The use I've had for locking is for purely decorative items in the background that I never want to accidentally select and move.  For example, I have a filled rectangle behind several controls which is locked in place so that if I drag across the controls to select them the rectangle behind them doesn't move.
Message 3 of 7
(6,494 Views)

nathand a écrit:
The use I've had for locking is for purely decorative items in the background that I never want to accidentally select and move

Darren, Nathan, thanks for pointing the lock feature out. I never used it before but it may be usefull for decorations.

Message Edité par Mathieu Steiner le 04-21-2009 11:49 AM
0 Kudos
Message 4 of 7
(6,411 Views)

The idea of using Lock or Group to hide the pesky shadow behind controls works great for "hovering" controls over clusters.

Richard






0 Kudos
Message 5 of 7
(6,380 Views)
in my experience locking controls do not scale as well when you run the application on different screen resolutions
- James

Using LV 2012 on Windows 7 64 bit
0 Kudos
Message 6 of 7
(6,365 Views)

There is another feature.

 

I think what you wrote:

In a similar fashion, if you have a group of controls whose position relative to each other you want to remain unchanged when the panel is resized (and there is a resizable object on the panel), you can group or lock those controls.  For examples of this behavior, check out Tools > Profile > VI Metrics or Tools > LLB Manager.  Both of these dialogs have a large list item that resizes when you resize the front panel, but all the other controls are grouped so their positions relative to each other do not change when the window is resized.

is described in this image:

 

 

I learned this trick from Michael Aivaliotis, but I cannot find the exact post.

 

Ton

Message Edited by TonP on 04-22-2009 03:22 PM
Message Edited by TonP on 04-22-2009 03:24 PM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 7 of 7
(6,271 Views)