We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Deleting symbol from a diagram - delete key doesn''t work

Hello, The delete key no longer works in my diagram component. I tried it also with the Custom Symbol Sample, and it doesn''t work here either. However the diagram builder sample works OK. In the Custom Symbol Sample, the Diagram_ChildrenChanging event is fired when I insert a symbol, but not when I press the delete key. I.e. it is impossible to delete the symbol. In the Custom Symbol Sample, the keypress event is not even fired when I press the delete key. By the way, this is on a W2k machine. Is this the intended behaviour? Thanks Richard

2 Replies

RD Richard Deverson June 22, 2005 12:24 PM UTC

It seems that if a symbol is programmatically created from a symbol model (with CreateSymbol()), then the delete key doesn''t automatically work. Or have I missed something here? As a "workaround", I do this: private void diagram1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if(e.KeyCode == Keys.Delete) { diagram1.Delete(); } } Is this the recommended solution?


AD Administrator Syncfusion Team June 22, 2005 10:17 PM UTC

Richard, Essential Diagram does not have built-in functionality for intercepting the delete key. You will have to handle the Diagram.KeyDown event and call the Diagram.Delete() method if the Delete key is pressed. Your implementation is correct. The DiagramBuilder sample does not have a handler for the Diagram.KeyDown method only because it has a Delete menu item that specifies the Delete key as the shortcut key, and uses that command handler for invoking the Diagram.Delete() call. Thanks, Prakash Surendra Syncfusion Inc., >It seems that if a symbol is programmatically created from a symbol model (with CreateSymbol()), then the delete key doesn''t automatically work. Or have I missed something here? > >As a "workaround", I do this: > >private void diagram1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) >{ > if(e.KeyCode == Keys.Delete) > { > diagram1.Delete(); > } >} >Is this the recommended solution?

Loader.
Live Chat Icon For mobile
Up arrow icon