You will need to do this using Script.
In the AfterClick event of your delete button you will need to run the deletefile function.
//Note not tested.
procedure frmYourFormName_Button1_OnAfterClick (filetext : string);
var FileName : string;
FileName := filetext;
if FileExists(FileName) then
MessageBox('File ' + FileName + 'does not exist ','Delete Error ' , MB_OK+MB_ICONERROR);
There are at least a couple of ways on how to pass the filename to the Button event.
First is to have a label or textedit that has its Visible property set to false and write the SQL to populate the label Caption or the Text of an edit text and then pass that to the filetext parameter.
or call the Button_OnClick event and write the delete SQL code there.
It depends on whether you have already written code to delete the entry in the database or if you are letting MVD do it for you behind the scenes.
localImagePath : string;
ImageId := intToStr(frmYour_form_name.your_component_name.dbItemID);
localImagePath := SQLExecute(' SELECT your_database_field_name FROM your_table_name WHERE id="'+ImageId+'"');
frmEdit.text := localImagePath;
// The above code needs to be called before you delete the database entry if you are using the inbuilt delete function of MVD. If you are writing the code yourself for the complete delete function, you could combine the above code into the button click event. Unless you want a universal function to call for other file deletions.
On a clear disk you can seek forever