LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatic Property Node

Solved!
Go to solution

I'm running into a bit of an issue with Labview that so far we've been able to kind of work around, but it's becoming more of an issue the more we work on our application.  I'm using Labview as the user interface to control and retrieve information from a Zigbee wireless network.  Part of our application requires using a large number of boolean indicators on the front panel, each indicator representing a wireless device.  As of now, we're starting our application with a number of hidden indicators, and making them visible one-by-one as devices show up on our network; this is a work-around for the fact that there doesn't seem to be any way to programmatically create indicators.  If I want to change the position properties of a subset of these indicators using property nodes, is there any way to programmatically reference an indicator?  For example, say our indicators are named Tag1, Tag2, Tag3, etc.  It would be easiest to have a for loop that writes positions to a generic property node that can be referenced to specific indicators, maybe the input is a string for the indicator label than can be easily incremented according to the current iteration of the for loop.  Is this possible or is there another way to accomplish this?  Thanks.

 

Dan 

0 Kudos
Message 1 of 8
(5,245 Views)

Depending on how complex your network is you might consider a different method like using a picture control to draw the network representation.

But yes you can get a reference to an indicator either by rt clicking and creating a reference or by using the controls[] properity of the owning pane and itterating throiugh the controls by name.  There are many examples of this on the forum.

 

 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 8
(5,231 Views)

COLOR.png

Note:

I used decorations for this example.  Decorations have an order but not a name and they are hard to programmatically distinguish from each other.  (the order is Front to Back )

In your application I would use controls that exist on their own pane (like inside a sub panel.)  You will want to sort the array of referances by control name because the array out of the Controls[] property node is again based on FP Frontness. and one simple cosmetic change can ruin your code.


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 8
(5,220 Views)
Solution
Accepted by DanRW

DanRW wrote:

...there doesn't seem to be any way to programmatically create indicators...


This is true; at run time we cannot add new objects since it would require the code to recompile. Your method of hiding/unhiding objects is completely valid, however, and I have seen it used in many HMIs.

 

This snippet is similar to Jeff's, yet lets you enter a name of a control(ie LED, indicators are considered controls in VI server references) and move it by hitting the 'Change Position' latch boolean.

 

moveobjects.png

Rob K
Measurements Mechanical Engineer (C-Series, USB X-Series)
National Instruments
CompactRIO Developers Guide
CompactRIO Out of the Box Video
0 Kudos
Message 4 of 8
(5,188 Views)

Just A couple thoughts-

you are probably going to want to display some information about the connected devices (ID, Type of node, path, etc...) In addition to the position and visibility you can also programatically set the indicators colors[4], discription, tip strip, caption.text and caption.visable.  You cannot change the lable.text while the vi is running (it causes a recompile.) 

 

Think about how you might show the link paths with different colored sets of custom controls that resemble arrows ... Sounds like a fun project

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 8
(5,174 Views)

Thanks, great help.  Exactly what I was looking for.  From the array of text labels for the controls, I search for the label of the control I want to isolate in a loop and return the index of that label in the array.  I use this index value to index the array of controls to get the control I want.  Then I want to create a mouse down event on that control.  So I've tried to create a user event to register a mouse down on the control I isolate from the array of controls obtained using similar code above.  I register the mouse down event and run it into the dynamic event terminals of the event structure, but when I create a case for that dynamic event, it creates an error saying that the event source is unnamed or something similar.  Any idea how to fix this?

 

The main thing I want to accomplish is that I have a series of indicators that I want the user to drag-and-drop sequentially onto an image that has been loaded into a picture indicator.  Once the user has placed the first indicator where they want, they will hit a place indicator button to signal the end of the current indicator placement; then they will do the same with the second, third, fourth, etc. indicators.  My idea was to have a for loop that runs as many iterations as I have indicators I want the user to place.  Each for loop iteration would operate on a different indicator; within the for loop is a while loop that contains the drap-and-drop events, and that for loop is ended with a press of the place indicator button.  Is there a better way to do this, or is there a simple fix for the dynamic event source error I was seeing?

0 Kudos
Message 6 of 8
(5,121 Views)
Got it working.  Turns out I can just use a Register For Events block without worrying about creating or generating user events.  I guess I was a little confused about the difference, but I got it doing exactly what I wanted.  Thanks for providing exactly what I needed.  Great help guys, thanks!
Message 7 of 8
(5,090 Views)

Great Work!

Glad we could help


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 8
(5,070 Views)