procedure TForm1.DeleteButtonClick(Sender: TObject); var node : TTreeNode; mess, str : string; key_stat : integer; begin Node := Treeview1.Selected; if Assigned(Node) then begin str := Node.Text; mess := 'Are you sure that you want to delete the'; Case Node.ImageIndex of 15 : mess := mess + ' folder ' + '"' + str + '"?' +#13+ 'All folders, subfolders, items and subitems will be permanently' +#13+ 'deleted.' +#13; 17 : mess := mess + ' item ' + '"' + str + '"?' + #13; end; with Application do begin NormalizeTopMosts; key_stat := MessageBox(pchar(mess), 'Confirm Deletion', MB_YESNO); RestoreTopMosts; end; if key_stat = 7 then Exit; TreeView1.Items.Delete(Treeview1.Selected); end else ShowMessage('Select a folder in the treeview first.'); end;
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.