Revised for version 12. Now, viewportLayout1 is of type Model.
Here is the simplest approach to show a dialog box to ask a confirmation before deleting selected entities:
public class MyVieportLayout : ViewportLayout
{
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode == Keys.Delete)
{
if (MessageBox.Show("Do you want to delete the selected entities?", "Title", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
base.OnKeyDown(e);
}
}
}
}
Comments
Hi Alberto,
After adding this code, when i press the No button it still deletes the entity. We need to add an else case.
Regards
Z.Mustafa Cakir
I'm sorry. It's my mistake. Code works perfect.
Best regards
Z.Mustafa Cakir
Please sign in to leave a comment.