Dynamic change of text in diagram view
This function and the API used in this function have been released in advance. We do not guarantee the quality at this time, so if you use it, please use it at your own risk. Also, please note that these specifications are subject to change without notice.
Overview
You can change the string displayed as text on the diagram view to a dynamically determined string based on the state of the model, etc., instead of the value of a string type field. You can also parse the input string and update the model field value when editing the text on the diagram view.
Achieving dynamic text change requires the following implementation:
- Implementation of callback function
- Implementation of callback function registration process
Implementation of callback function
Implement a callback function for dynamic text changes. There are the following types of callback functions:
- get text value callback function
- set text value callback function
The implementation of each callback function is described below.
Get text value callback function
The signature of the get text value callback function is:
For details, please refer to the argument getter description of IViewDefinitions.RegisterTextValueCallback method.
Callback function signature
string get_TextValueFunction(IShape shape, TextTypes type, string textPath, IModel model)
- This callback function is called before the diagram view is displayed and the text is displayed.
Time to call the callback function
Set text value callback function
The signature of the set text value callback function is:
For details, please refer to the argument setter description of IViewDefinitions.RegisterTextValueCallback method.
Callback function signature
void set_TextValueFunction(IShape shape, TextTypes type, string textPath, IModel model, string value)
- This callback function is called after confirming the text editing in the diagram view.
There are two things to keep in mind when implementing text value setting callback functions (setters):
-
Considerations for passed text values
Arguments: The string displayed in the diagram view is passed to value as is.
Note that if you are using the Get Text Value callback function to modify the displayed string, the modified string will be passed. -
Consideration for multiple calls
The set text value callback function is called each time you commit a text edit in the diagram view.
Implement the callback function so that the data at the setting destination will not be inconsistent even if it is called multiple times.
Implementation of callback function registration process
Implement the callback function registration process in the Activate
method, which is a public method of the main class that implements IExtention.
For details, please refer to each method of IViewDefinitions interface.
-
API used for registration process
Target Callback function registration API Text value (title/label) IViewDefinitions.RegisterTextValueCallback method