Event arguments for the query-label-adding and query-label-editing events, as well as the IEditLabelHelper interface.
Remarks
Type Details
- yFiles module
- view
Constructors
Initializes a new instance of the LabelEditingEventArgs class with the given context, owner, and label.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The input mode context to use.
- owner - ILabelOwner
- The ILabelOwner whose label should be edited.
- label - ILabel
- The ILabel that should be edited.
Properties
Gets or sets a value indicating whether the action (adding or editing a label) should be canceled.
Remarks
true
.Gets the context for the current event.
Gets or sets a value indicating whether this event has been handled.
Remarks
A handled instance of LabelEditingEventArgs will not be passed to further event handlers or an IEditLabelHelper instance.
Setting a value to label, owner, or cancel implicitly also sets this to true
.
Note that this property needs to be set before the function synchronously returns. This means that setting the value in an async
function after the first await
or in an asynchronous callback, it cannot not be seen by the emitter of the event and the sender will consider the event as not being handled.
// wrong:
mode.editLabelInputMode.addEventListener(
'query-label-adding',
async (evt) => {
await something()
evt.handled = true // will be set *after* all other event listeners have been invoked, only
},
)
// correct:
mode.editLabelInputMode.addEventListener(
'query-label-adding',
async (evt) => {
evt.handled = true // will be set immediately and 'mode' will see the change
await something()
},
)
Gets or sets the label to edit.
Remarks
This can be set to an existing label to edit a specific one, or set to null
to add a new label instead (e.g. for ILabelOwners that have no label yet).
If this property is explicitly set to null
, the properties style, preferredSize, layoutParameter, and tag are used for the newly-added label, just like with LabelEditingEventArgs.
Setting this property implicitly also sets handled to true
.
Note that this property may be initialized to null
by calling code. However, in order to trigger automatically adding a new label, you need to set the property value explicitly to null
even in that case.
Gets or sets the layoutParameter of the label to add.
Gets or sets the owner of the label.
Remarks
This property can be null
if there is no owner known, e.g. if the event is raised for non-ILabelOwners. Otherwise, it is initially set to the item for which the event is raised.
Setting this property implicitly also sets handled to true
.
Gets or sets the preferredSize of the label to add.
Gets or sets the style of the label to add.
Gets or sets the tag of the label to add.
Gets or sets the configurator for the TextEditorInputMode for editing the provided label instance.
Remarks
Signature Details
function(context: IInputModeContext, mode: TextEditorInputMode, label: ILabel)
Parameters
- context - IInputModeContext
- The context in which the label is being edited or created.
- mode - TextEditorInputMode
- The mode that will be used for editing the label's text.
- label - ILabel
- The label that will be edited or created.