LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatic binding of Front Panel Control

Solved!
Go to solution

Ok,  Now I understand that the real problem is that the attach datasocket method or the shared variable binding do not work

with vi's that are in a project.  If my vi is standalone then I can programmatically bind to either datasocket or

NSV.  Perhaps there is some secret URL neeed.  I know it is possible since the Front Panel Binding Mass Configuration Utility seems to be able to do the job.  

 

0 Kudos
Message 11 of 16
(1,708 Views)

Problem Solved!  Thanks to everyone who responded.  It seems that my last issue was the result of trying to run my binding vi outside of the project that contained the HMI vi that I was trying to perfom the binding on.  When I

included the binding utility in the same project everything worked as advertised.

0 Kudos
Message 12 of 16
(1,690 Views)

sachsm wrote:

Problem Solved!  Thanks to everyone who responded.  It seems that my last issue was the result of trying to run my binding vi outside of the project that contained the HMI vi that I was trying to perfom the binding on.  When I

included the binding utility in the same project everything worked as advertised.


I'm not sure what was going wrong in your case.

 

In general, binding of front panel controls, either while the VI is running (if the control/indicator is already bound to the same type of connection) or remotely from another VI should work both inside and outside of a project. Also you can have the VI with the front panel control inside the project and the VI doing the binding outside.

 

For direct binding to the Shared Variable Engine using PSP I found that the following path works well across the board

 

\\lumpy5\SVLib\Variable1

 

lumpy5 is the name of the computer on the network. To programmatically change a PSP binding use the Data Binding>Path property.

 

If you use DataSocket to bind the control to the shared variable the URL is

 

psp:\\lumpy5\SVLib\Variable1

 

To programmatically change a DataSocket binding use the DataSocket>URL property.

 

In either case if you want to change the binding of a front panel control while the VI is running, the control must already be bound to a shared variable using the same binding type (either PSP or DataSocket) as you are attempting to reassign.

 

If you want to bind a front panel control which is currently unbound, the VI with the front panel control must be in edit mode (not running). Then you can either interactively make the binding using the dialog window, or you can use another VI to programmatically create the binding in the non-running VI. To programmaticaly make the binding it is easiest to use either the DataBinding>Bind to Network Path method for PSP or the AttachDataSocket method for DataSocket.

 

I have attached my test VIs and project for reference.

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
0 Kudos
Message 13 of 16
(1,680 Views)

sachsm wrote:

It appears that Programmatic binding of Front Panel Controls do not work when they are located on a tab control. 

Is this a known issue in LV 8.6?


I am running LV 7.1, and am having a similar issue.

 

More specifically, when I open a reference to a vi and get the control text labels it skips over any controls within a tab structure,

so I can't even get a reference to a control in a tab, to attempt to bind to it.

 

See the attached image - maybe there's another way to go about getting the refs?

 

Thanks!

 

 

0 Kudos
Message 14 of 16
(1,615 Views)
To gain access to control on a tab you must first get a reference to the tab itself and then obtain its array of controls.
Message 15 of 16
(1,608 Views)

Thanks for the tip - I'm running LV 7.1, so I wasn't able to access your examples.

 

However, I was able to get it working. I am referencing a tab control from an external vi, so I had to pull out the tab control reference from the array of all refs and cast it to a tab reference - which worked.

 

I was then able to pull out the refs of the controls on the tab control.

 

 

 

 

0 Kudos
Message 16 of 16
(1,588 Views)