Table Of Contents

Creating a Custom Data Type Using a G Type Document

Last Modified: January 2, 2018

Create a G Type, or custom data type, to reuse a control or constant throughout your project. You define the G Type with the control you add to the panel of a G Type document.

An example of when a G Type would be useful is keeping state enums of a state machine in sync. Because instances of a G Type share a source file, you can update the source enum, the G Type, with additional states as needed and propagate the changes to all instances rather than having to update each copy individually.

  1. From the Project Files tab, use the Add Item menu to create a G Type document.
  2. In the G Type document, add a single control, array of controls, or cluster of controls that you want to reuse throughout your application. The data type of the control you add to the G Type document panel defines the data type of the G Type.

    Adding more than one control outside of an array or cluster or more than one array or cluster of controls to a G Type document makes the G Type unusable.

  3. In the Item tab, configure the control with the settings you want to persist to each instance of the G Type.

    When you place an instance of a G Type onto the panel, the G Type control is identical in type, appearance, and configuration to the control you use to define the G Type in the G Type document. Make sure the control you add to the G Type document is of sufficient size to display all necessary data. If you need to adjust the size or configuration of a G Type instance, you must modify the control in the G Type document.

  4. Save the G Type document.
Drag the G Type from the Project Files tab to the panel or diagram to add an instance of the G Type to your code.

Recently Viewed Topics