Bind a front panel control to a shared variable if the VI from which you want to manipulate the front panel control is in the same project as the VI with the front panel control. You can bind controls only to network-published shared variables.
Complete the following steps to control a front panel control from another VI using a shared variable.
- Create a shared variable.
- Create a VI with a control in the front panel window to write the front panel data to the variable you created. Right-click the control and select Properties from the shortcut menu. On the Data Binding page of the Properties dialog box, select the Read/Write option in the Access Type pull-down menu.
- Run the VI.
- Either on the local computer or a remote computer, open the project containing the shared variable you created in step 1.
- Create a new VI with a control in the front panel window and bind the control to the shared variable you created in step 1.
- In the front panel window of the second VI in the project, right-click a front panel object and select Properties from the shortcut menu to display the Properties dialog box for the object.
- Click the right arrow button to navigate to the Data Binding page of the Properties dialog box.
- Select Shared Variable Engine (NI-PSP) from the Data Binding Selection list.
- Click the Browse button to navigate to the shared variable you created in step 1.
- In the Select Source Item dialog box, select the Network Items option from the Network-Published Source item pull-down menu.
- Click the OK button to close the Select Source Item dialog box.
- Click the OK button to close the Properties dialog box.
 |
Note If you enter a value in the Path text box, LabVIEW disables the OK button when you begin entering the value. To reenable the OK button, click outside the Path text box. If the string contains a valid variable path for binding, LabVIEW reenables the OK button. If the string in the Path text box is not valid, fix the string or select an item from the Source Items list. |
- Run or continually run both VIs. While the VI is running, if the connection to the Shared Variable Engine is successful, a small green indicator appears next to the front panel object on the VI. If the connection is not successful, a small red indicator appears. Before LabVIEW attempts to connect to the server, a small transparent indicator appears. A status message also appears if you move the cursor over the indicator. You can hide this indicator by right-clicking the front panel object and selecting Visible Items»PSP LED from the shortcut menu. You also can use the Data Binding:LED Visible property to hide the indicator programmatically.
The front panel control in the first VI retrieves the value the second VI passes through the connection. When a user changes the control value in the second VI, the connection writes the new value to the front panel control in the first VI. If the front panel control has write-only access, the control writes the initial value when the VI runs or every time the VI resets if the VI runs continuously. If the front panel control has read-only or read/write access, the control reads the initial value when the VI runs.