Page 1 of 1

Confirmation of node deletion

PostPosted: February 15th, 2007, 9:13 pm
by MrBaseball34
I am trying to confirm deletion of selected nodes and I don't think I'm doing it correctly:

Code: Select all
procedure TMainForm.SimpleGraphKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = VK_DELETE then
  begin
    if (MessageDlg('Are you sure you want to delete the selected object(s)?', mtConfirmation, [mbYes, mbNo], 0) <> mrYes) then
      Key := 0;
  end;
end;


But the node is deleted before the MessageDlg even appears.
Any ideas??

PostPosted: February 16th, 2007, 12:37 am
by Kambiz
:? The OnCanRemoveObject event is introduced for this purpose.