From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Obtain reference to decoration

Solved!
Go to solution

I'm designing an application for training a subject for a task.  I want to place a "target" on a blank screen, have the subject move a joystick, and track the target.  For the target, I'd like to use a decoration, and use property nodes to change its size, color, position, etc.  There may be more than one decoration, so I'd like to create explicit references (that I can name) for each one.

 

I found (as others have) the "Label" property, but no way to reference it.  I also found a Right-Click-Framework tool by Ton Plomp, but cannot get it to work (I'm running LabVIEW 2012 on a Windows 7 machine, and I've seen numerous references to RCF no longer working -- I've not tried to use it until now) (I also cannot view the movie that tells "how to" use Ton's tool -- right-clicking just brings up the "usual" Right-click menu on the Decoration).

 

There is a discussion about replacing the RCF tool with a Quick Drop tool -- has anyone done this?  Does anyone have a solution?

 

I do know how to get "all the Decorations", and if there is only one on a Pane, I could just use it (no problem identifying them).  But I'd like to avoid really messy (hard to document, hard to explain, hard to debug) situations with multiple decorations, hence the desire for an explicit referencing method.

 

Bob Schor

0 Kudos
Message 1 of 12
(4,291 Views)

If you are saving VIs with multiple decorations, use tags to mark which decoration is which.  You will need to programatically set them on the decorations.  You could write a quickdrop shortcut to do this so that you can tag items interactively.

Message 2 of 12
(4,286 Views)
From your description it sounds like you could place and move a colorbox. Easy to change size, position and color of.
/Y
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 3 of 12
(4,266 Views)

From your description it sounds like you could place and move a colorbox. Easy to change size, position and color of.



Interesting idea -- I've used Color Box constants, but never as Front Panel Objects.  I just tried creating a Color Box and saying "Shazam, you are a Control!", and I now have a square black box on my Front Panel.  But I want something round ...  (In an earlier study, when the target was an actual button, I used a Boolean "Light" indicator, which was round, and actually looked like a button-to-be-pressed.  But in this study, I just want a region, such as the circle decoration provides.)

 

Message 4 of 12
(4,260 Views)

@DFGray wrote:

If you are saving VIs with multiple decorations, use tags to mark which decoration is which.  You will need to programatically set them on the decorations.  You could write a quickdrop shortcut to do this so that you can tag items interactively.


Thanks for the idea.  I've not (yet) written any QD shortcuts, but this sounds intriguing.  There doesn't seem to be a lot of information on How To Use User Tags, but "experimenting with LabVIEW" is fun!

 

I was thinking about How to Get Started.  Tags seem to be "purely programmatic" things, meaning you need to run a VI to determine if a Decoration is tagged, and what its tag is called.  I was thinking about the following "brute force method" (but see the next paragraph ...):

  1. Open a new VI
  2. Put, say, 4 decorations on it.
  3. Write code to find the array of decorations on the Pane, open each, and give it a tag, say the strings "1", "2", etc.
  4. Save the VI (thereby "saving" the tags).
  5. Now replace the code with code that helps identify the VIs, such as lines them up in "name order".
  6. Put a Label (to tell them apart during Development), e.g. "1", "2", etc. on each.
  7. Go ahead and "develop" the application using the now-labelled-and-tagged decorations.

While I was about to write all this, the "Light Bulb" suddenly went off in my head -- why not try to write the "creation" code using LabVIEW scripting?

 

More things to think about, but now I'm more confident that I'll be able to get a better "handle" on decorations.  Further helpful suggestions are still welcome.

0 Kudos
Message 5 of 12
(4,242 Views)

If you just want to move a round object around on the front panel, a picture control covering the entire front panel with a single filled circle might give you better performance.  You will not need to go through scripting to implement it.  If you want to go the scripting route, a classic LED is circular, can be colored a solid color and moved around.  3D knobs are also circular.  I used one in an "asteroids" game I wrote in LabVIEW 6 to learn scripting.  Unfortunately, performance was so low I never pursued it beyond getting the control to move around.  My next step would have been to use a picture control...

0 Kudos
Message 6 of 12
(4,232 Views)

@DFGray wrote:

If you just want to move a round object around on the front panel, a picture control covering the entire front panel with a single filled circle might give you better performance.  You will not need to go through scripting to implement it.  If you want to go the scripting route, a classic LED is circular, can be colored a solid color and moved around.  3D knobs are also circular.  I used one in an "asteroids" game I wrote in LabVIEW 6 to learn scripting.  Unfortunately, performance was so low I never pursued it beyond getting the control to move around.  My next step would have been to use a picture control...


Again, good ideas, but nowhere as easy as a "reference-able decoration".  I've never used Picture Controls -- don't they hold basically static pictures (that can be moved, but not resized, colored, etc. easily at run time)?  I need to be able to vary the test, including changing size, position, color, number of objects, and making objects appear and disappear (that's easy -- Visible).  Another confession -- I've never used the Classic Controls.  The Classic LED "almost" works, but it isn't a simple (colorable) circle.  Haven't thought about knobs (without pointers, I'd presume), but these are still kludges to doing what seems simple (but, sadly, isn't), namely using Decorations "creatively".

0 Kudos
Message 7 of 12
(4,192 Views)

The Silver LED/boolean light is round and rather general, try that out. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 12
(4,183 Views)

Is there other characteristics of the decorations that seperate them?  Like will there always be of them on in each corner of the screen?  If so you can identify them by the position property.  OpenG has a function that fits the front panel to the largest decoration.  The code is simple and just uses the All Decorations property then finds the one with the largest area.  If you can identify them by something you can know which reference corresponds to which one.  Of course Tags are one way to do that too.

0 Kudos
Message 9 of 12
(4,162 Views)
Solution
Accepted by topic author Bob_Schor

Actually, picture controls are as dynamic as moving controls around.  Here is a quick demo.  It could just as easily have changed the color and size of the circle.  There are API functions to do a variety of polygons.

 

Code in LabVIEW 2011

0 Kudos
Message 10 of 12
(4,156 Views)