Skip to content

Attribute

Attribute class is used for populating Attributes/Records View controls. Also can be used for storing structured data.

Constructor:

  • constructor(dict, subattributes?: Attributes | Attribute[] )
    Initializes an attribute with a given dictionary and optional sub-attributes.

Properties:

  • kind: AttributeKind (read-only)
    The kind of the attribute. Can be one of: Field, Panel, Sheet, Space, Button, Image, HorizontalSplit
  • name: string
    The name of the attribute.
  • label: string
    A label for the attribute.
  • labelWidth: string | number
    Width of the label in the form: 25/'10ch'/'25%' (ch - character width. % - percentage of the parent width).
  • hint: string
    A hint for the attribute.
  • type: AttributeValueType
    Attribute value data type. It defines which kind of editor AttributesView will show for this attribute. Can have one of AttributeValueType values: Boolean, Integer, Largeint, Numeric, Currency, Float, Double, Date, Time, DateTime, FixString, String, MaskEdit, Password, HyperLink, Memo, RichText, Blob, Image, Object.
  • width, height: string | number
    Dimensions for the attribute in the form: 25/'10ch'/'25%' (ch - character width. % - percentage of the parent width).
  • margins: string | number | Margin
    Margins around the attribute.
  • value: any
    Current value of the attribute.
  • getValue?: (attr)=> any
    Getter function for attribute value .
  • setValue?: (attr, v)=> {}
    Setter function for attribute value .
  • getValues?: (attr)=> AttributeValues
    Getter function for possible values for this attribute value.
  • oldValue: any
    Previous value of the attribute.
  • defaultValue: any
    Default value of the attribute.
  • values: AttributeValue[] | AttributeValues (read-only)
    Possible values for the attribute.
  • attributes: Attribute[] | Attributes (read-only)
    Child attributes. Referred to elements of more complex Attribute implementations like: AttributeSheet, AttributePanel, AttributeHorizontalSplit.
  • subattributes: Attribute[] | (rec) => Attribute[]
    Sub-attributes collection/array or getter function returning Sub-attributes collection/array. It’s used to define tree-like dependencies.
  • readOnly, visible, enabled, expanded: boolean | (attr) => boolean
    Setting or obtaining via getter readOnly, visible, enabled and expanded properties for AttributesView/RecordsView.
  • background: string | (attr)=> string
    Background color name or getter function returning background color name
  • foreground: string | (attr)=> string
    Foreground color name or getter function returning foreground color name
  • alignment: Alignment
    The alignment of the content.
  • font: Font
    Font used for the attribute.
  • formatDisplay, formatEdit: string
    Formatting for display and editing of the attribute.
  • parent: Attribute (read-only)
    Parent attribute.
  • children: Attribute[] | Attributes (read-only)
    Child attributes.
  • commands: AttributeCommand[] (read-only)
    Commands associated with the attribute.
  • data: any
    Custom data you can attach to each attribute.
  • expanded: boolean
    Indicates whether sub-attributes are expanded or not. Has effect when attribute has sub-attributes.

Methods:

  • delete()
    Deletes the attribute.
  • invalidate(withChildren?: boolean)
    Invalidates the attribute and optionally its children.
  • click(handler?): any
    Adds a click event handler. Returns the previous handler if it exists.
  • doubleClick(handler?): any
    Adds a double-click event handler. Returns the previous handler if it exists.
  • buttonClick(handler?): any
    Adds a button click event handler. Returns the previous handler if it exists.