LabWindows/CVI

Content Type
Programming Language
Current manual

Custom Controls Overview

Edit/Create Custom Controls

You can create custom controls to save control configurations. Custom controls are based on existing user interface controls. LabWindows/CVI saves your list of custom controls between sessions. To use a custom control, select Create»Custom Controls and select the control you want to use. You can edit the saved configurations of the custom controls by double-clicking the control name and opening the Edit Control dialog box.

To create a custom control, create a control as you normally would. Select Create»Custom Controls»Edit to display the Edit Custom Controls dialog box, which contains the following options:

  • Add—Opens a dialog box that contains a list of all the controls on the user interface panel, a preview of the control appearance, and the name that will appear in the Create menu. Select the control you want to add as a custom control and click OK.
  • Delete—Removes the selected control from the Create menu.
  • Edit—Opens the Edit Control dialog box.
  • Edit Name—Opens a dialog box in which you can change the name of the control.
  • Code—Opens a dialog box in which you can associate the following files with a control:
    • Program File—A .fp file, source file, or object file that implements additional functionality for the control. When you select Code»Generate»All Code or Generate Custom Control Code, LabWindows/CVI automatically adds the program file to the project. For example, you can specify a .fp file that contains functions to create a new custom control.
    • Header File—The include file that accompanies the program. When you select Code»Generate»All Code or Generate Custom Control Code, LabWindows/CVI includes the header file at the top of the source file.
    • Template File for main—Contains code to instantiate a custom control at run time.

      The template (.cct_c) file has the following structure:

      @CONVERT
         CustCtrlCreationFunction (@REPLACE[panel], @REPLACE[control]);
      @REVERT
         RevertCustCtrlToUICtrlFunction (@REPLACE[panel], @REPLACE[control]);

      The @CONVERT command calls the function that creates the custom control. When you select Code»Generate All Code or Generate Custom Control Code, the @CONVERT command adds the specified function to the main function after the call to LoadPanel. The @REPLACE command replaces [panel] with the panel handle returned by LoadPanel and replaces [control] with the control ID of the custom control. You also can specify [uirfile] to replace the user interface filename in the code.

      The @REVERT command returns the custom control to the user interface control on which it is based when you place the user interface panel in edit mode. This command is used when you enable Operate in UI Editor and place the user interface panel in operate mode and then place the panel in edit mode.
    • Operate in UI Editor—In operate mode, LabWindows/CVI automatically generates a DLL, which allows the control to behave as it would in a complete application. You can interact with the control in operate mode.
  • Move Up—Moves the selected control up one line.
  • Move Down—Moves the selected control down one line.
  • OK—Accepts the modifications you made in the Edit Custom Controls dialog box and closes the dialog box.
  • Cancel—Closes the dialog box without accepting any changes.

LabWindows/CVI provides the following custom controls:

Was this information helpful?