BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi
how to disable any keyboard command or specifically the delete key
Regards
Hello
I wanted to communicate that the solution to my problem lies in the constraints that can be set in the various nodes, connectors and so on.
thanks anyway
Hi Salvatore,
Please find the response below.
Query |
Response |
||
how to disable any keyboard command or specifically the delete key |
We met your requirements at the sample level. You can disable any key or override the keyboard command in SFDiagramComponent by using the CommandManager. Using CommandMananger, you can change the built-in commands. CommandManager has a Commands property, Execute and CanExecute callback method. Commands representing the storage of multiple command names denote the corresponding command object. Execute is used to run the command on the currently selected command target. CanExecute determines whether this command in its current state can be executed. You must specify which commands you want to change or disable in Commands property of CommandManager. If you want to disable the key, set false in the CanExecute method. To override the commands, you must set true in that method. You can also override the functionality of any commands by adding functionality to the Execute method. We have provided a link to our online UG for your convenience. We have also provided a sample for your reference.
UG link: https://blazor.syncfusion.com/documentation/diagram/commands#modify-the-existing-command
|
||
I wanted to communicate that the solution to my problem lies in the constraints that can be set in the various nodes, connectors and so on |
We suspect that you want to restrict the deleting of all nodes and connectors while performing a delete operation with a keyboard delete key or a user handle or any button click. You can achieve your goal by removing the Delete constraint from all the nodes and connectors in the SfDiagramComponent's NodeCreating and ConnectorCreating events. The NodeCreating event is used to set the node's default properties and the ConnectorCreating event helps to assign the connector's default properties. Using the NodeCreating and ConnectorCreating events, you can remove delete constraints from nodes and connectors. We've included a code snippet for your convenience. CodeSnippet:
|
If we misunderstood your requirement, could you please explain it in full detail? It will be helpful to provide a better solution.
Note: In the first query, we provided a solution to disable the delete key by overriding our default functionality. It is not dependent on the second query.
Regards,
Sumathi U.