Skip to main content

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

Namespace: NextDesign.Core

Description

Specify the style attribute and register the style value acquisition callback function of the specified text of the editor element generated from the specified editor element definition.

  • It is recommended to call it when the extension is activated.
  • Style values are acquired in the following order of priority.
  1. Callback function value for style value acquisition
  2. Style value set in the view instance
  3. Style value defined in the view definition
  • If you want to change the text color of the title text, redefine the text color in the callback function of RegisterGetStyleCallback.
  • The trigger for calling the registered callback function is as follows. ・ The editor element is displayed
  • The field value of the model referenced by the editor element has changed.

argument

NameTypeDescription
elementDefIElementDefEditor Element Definition
typeTextTypesText Types
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 ・ ・ ・ The shape that owns the label/text to be styled is passed.
--type: TextTypes ・ ・ ・ Target text type (enumeration) is passed
--textPath: string ・ ・ ・ Path character 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 ・ ・ ・ Target style attribute information is passed
--Return value
--object ・ ・ ・ Returns the object to be handled as a result of Get
--The callback function must be an object that matches the specified target style attribute type
/> --If you return an object that does not match the type, it will not be an exception and will be automatically converted to the value of IStyleProperty.CurrentValue.
-Handling of exceptions
-In the implementation of the callback function If you throw an exception, the exception is caught and the value of IStyleProperty.CurrentValue is used as the result of the callback call.
propertiesStyleAttributesStyle attributes
(If multiple style attribute names are specified, callback registration is performed for each)

Return value

  • void

Exception

NameException ClassDescription
Duplicate keyExtensionDuplicationExceptionIf the callback registration key is duplicated

Annotation

If the number of labels is 11 or more, the style value acquisition callback function cannot be applied to the 11th and subsequent labels.