Creating a Custom Data Type Using a G Type Document
- 更新时间2022-01-06
- 阅读时长1分钟
Creating a Custom Data Type Using a G Type Document
Create a type definition, or custom data type, to reuse a control or constant throughout your project. You define the type definition with the control you add to the panel of a G Type document.
An example of when a type definition would be useful is keeping state enums of a state machine in sync. Because instances of a type definition share a source file, you can update the source enum, the type definition, with additional states as needed and propagate the changes to all instances rather than having to update each copy individually.
- From the Project Files tab, expand the New menu and select Type Definition to create a G Type document.
-
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 type definition.Note 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 type definition unusable.
-
In the Item tab, configure the control with the settings
you want to persist to each instance of the type definition.
- Save the G Type document.
相关内容
- Updating Custom Data Type Instances Throughout Your Project
Modify a G Type document to update all the instances of a custom data type in your project.
- Type Definitions
Type definitions are custom data types that you define using the G language and can reuse throughout your project.