Skip to main content

IViewDefinitions.RegisterGetCompartmentItemTextStyleCallback(IElementDef, string, Func <INode, int, string, IModel, IStyleProperty, object>) Method

Namespace: NextDesign.Core

Description

Registers the style value acquisition callback function for the specified compartment item 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
  • The trigger for calling the registered callback function is as follows. ・ Compartment items are displayed ・ The field value of the model referenced by the compartment item has been changed.

argument

NameTypeDescription
elementDefIElementDefEditor Element Definition
areaPathstringCompartment partition path
getterFunc <INode, int, string, IModel, IStyleProperty, object>Callback function for getting style value

Callback function specification
object object get_ItemTextStyleFunction ( INode node, int areaIndex, string areaPath, IModel itemModel, IStyleProperty target)

-Arguments
--node: INode ・ ・ ・ The shape that owns the compartment item to be styled is passed.
--areaIndex: int ・ ・ ・ The partition index to which the style-applied compartment item belongs is passed.
--areaPath: string ・ ・ ・ Set to the partition definition to which the style-applied compartment item belongs. The path string (field name) that exists is passed.
--itemModel: IModel ・ ・ ・ The model referenced by the compartment item to which the style 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
--Callback function matches the specified target style attribute type Must be an object that does
--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
--If the callback function implementation throws an exception, the exception is caught and the value of IStyleProperty.CurrentValue is used as the result of the callback call.

Return value

  • void

Exception

NameException ClassDescription
Duplicate keyExtensionDuplicationExceptionIf the callback registration key is duplicated