Skip to main content

IViewDefinitions.RegisterCompartmentItemTextValueCallback(IElementDef,string,Func<INode, int, string, IModel, string>,Action<INode, int, string, IModel, string>) Method

Namespace: NextDesign.Core

Description

Registers a callback function to get/set the value of the specified compartment item of the editor element generated from the specified editor element definition.

  • It is recommended to call this when activating the extension.
  • The registered callback function for getting the value is called in the following cases.
     ・A compartment item is displayed
     ・A field value of the model referenced by the compartment item has been changed

Arguments

NameTypeDescription
elementDefIElementDefEditor element definition
areaPathstringPath to compartment area
getterFunc<INode, int, string, IModel, string>Callback function for getting text value

Callback function specification
string get_TextValueFunction(IShape shape, TextTypes type, string textPath, IModel model)

- Arguments
- node : INode ・・・The shape that owns the compartment item to which the style is applied is passed
- areaIndex : int ...The area index of the compartment item to which the style is applied belongs is passed.
- areaPath : string ... The path string (field name) set in the area definition to which the compartment item to which the style is applied belongs is passed.
- itemModel : IModel ... The model referenced by the compartment item to which the style is applied is passed.
- Return value
- string ... Returns the string to be treated as the result of Get.
- Exception handling
- If an exception is thrown in the implementation of the callback function, the exception is caught and the field value of textPath is used.
setterAction<INode, int, string, IModel, string>Callback function for setting text value

Callback function specification
void set_TextValueFunction(IShape shape, TextTypes type, string textPath, IModel model, string value)

- Arguments
- node : INode・・・The shape that owns the compartment item to which the style is applied is passed.
- areaIndex : int ・・・The compartment index to which the compartment item to which the style is applied belongs is passed.
- areaPath : string ・・・The path string (field name) set in the compartment definition to which the compartment item to which the style is applied belongs is passed.
- itemModel : IModel ・・・The model referenced by the compartment item to which the style is applied is passed.
- value : string ・・・The text requested to be set as the text value of the label is passed.
- Exception handling
- If an exception is thrown in the implementation of the callback function, the text setting is canceled.

Return value

  • void

Exception

NameException classDescription
Invalid argumentExtensionArgumentExceptionnull in elementDef If you specify
areaPath is null or an empty string
Duplicate keyExtensionDuplicationExceptionIf the callback registration key is duplicated