Skip to main content

IViewDefinitions.RegisterGetTextStyleCallback(IElementDef,TextTypes,Func<IShape, TextTypes, string, IModel, IStyleProperty, object>) Method

Namespace: NextDesign.Core

Description

Registers a callback function to obtain the style value of the specified text of the editor element generated from the specified editor element definition.

  • It is recommended to call this when activating the extension.
  • The style value is obtained in the following order of priority.
     1. Callback function value for getting style value
     2. Style value set in the view instance
     3. Style value defined in the view definition
  • To change the font color of the title text, redefine the font color in the RegisterGetStyleCallback callback function.
  • The registered callback function is called in the following cases:
     ・Editor element is displayed
     ・Field value of model referenced by editor element is changed

Arguments

NameTypeDescription
elementDefIElementDefEditor element definition
typeTextTypesText type
getterFunc<IShape, TextTypes, string, IModel, IStyleProperty, object>Callback function for getting style value

Callback function specification
object get_TextStyleFunction(IShape shape, TextTypes type, string textPath, IModel model, IStyleProperty target)

- Arguments
- shape : IShape ・・・Shape that owns label/text to which style is applied is passed
- type : TextTypes・・・The type of target text (enumeration) is passed.
- textPath : string ・・・The path string (field name) mapped in the text view definition is passed.
- model : IModel ・・・The model referenced by the editor element to which the tile is applied is passed.
- target : IStyleProperty ・・・The target style attribute information is passed.
- Return value
- object ・・・Returns the object to be treated as the result of Get.
- The callback function must be an object that matches the type of the specified target style attribute.
- If an object that does not match the type is returned, no exception will be raised and it will be automatically converted to the value of IStyleProperty.CurrentValue.
- Exception handling
- If an exception is thrown in the implementation of the callback function, the exception will be caught and the value of IStyleProperty.CurrentValue will be used as the result of calling the callback.

Return value

  • void

Exceptions

NameException classDescription
Invalid argumentExtensionArgumentExceptionWhen null is specified for elementDef
Duplicate keyExtensionDuplicationExceptionWhen callback registration keys are duplicated

Annotation

If 11 or more labels are defined, the callback function for retrieving style values cannot be applied to the 11th and subsequent labels.