Current Publication

Customizing Controls

LabWindows/CVI

Tools»Customize Function Panels

Use function panel customization to provide input selections for controls in function panels. For example, if a parameter in a function panel you are developing requires the device number of a DAQ device, you can provide a customized dialog box to help the user select the appropriate device number. The Select Attribute Constant dialog box in Get/Set...Attribute function panels is an example of a function panel customization within the LabWindows/CVI environment.

To include input selections for parameters, you must export a customization callback function from a DLL. You must then use the Customize Function Panels dialog box to associate that callback function with a function parameter. After you customize a function panel, LabWindows/CVI calls the assigned callback when a user presses <Enter> in the customized control or clicks the ... button next to the control.

Writing a Customization Callback Function

Customization callbacks must have the following prototype:

int CVICALLBACK CustomCallbackName (FPCustomInfo *info);

The bin\fpcustom.fp instrument driver provides functions that you can use in the customization callback code to retrieve information about the function described by a specific function panel or to obtain and change the current values of the function's parameters. Refer to the SelectColor function in the samples\functionpanels\Customization\SelectColor.cws sample program for an example of a customization callback that uses these functions.

Associating a Callback Function with a Parameter

Open the .fp file you want to customize and select Tools»Customize Function Panels to launch the Customize Function Panels dialog box. In the Customize Function Panels dialog box, Parameters lists input, numeric, and ring controls from function panels in the current instrument. The Functions column lists the function panels that contain the selected control.

Select one or more parameter controls and click Customize to open the Customize Controls dialog box. You also can access the Customize Controls dialog box by right-clicking a control when you edit a Function Panel window.

In the Customize Controls dialog box, select the DLL that contains the callback function you want to attach to the parameter. When you select a DLL, LabWindows/CVI populates Callback with the callback functions that the DLL exports. Select the callback that you want to attach to the parameter from this control. Specify the string encoding for the control in the Encoding field. To remove a DLL, callback, and encoding associated with a parameter, click Clear Entry.

Note  If the same parameter control appears in multiple function panels, LabWindows/CVI applies the customization to each instance of the parameter control.

LabWindows/CVI searches the following locations for customization DLLs.

  • The DLL path specified in the Customize Controls dialog box
  • The folder where the function panel is located
  • The default system search path

When you customize a function panel, LabWindows/CVI creates a function panel customization (.fpc) file, which contains the information you entered in the Customize Function Panels and Customize Controls dialog boxes. The .fpc file must be located in the same folder as the .fp file.