1 (edited by AD1408 2021-01-16 20:32:08)

Topic: Deleting linked rtf and image files after confirmation?

Hello All,


Derek was kind enough to show me how to save RTF files separately (linked) and deleting them and linked image files.
Only issue I have with it, delete take place as soon as I click the delete button, before the confirmation. What I'm looking for actual delete should take place after clicking "Yes" button on confirm dialog. I tried with onAfterClick event but didn't work.


Could anybody help please?

Post's attachments

Attachment icon SavingRTFasLINKED 3 Delete after Confirmation.zip 9.72 kb, 211 downloads since 2021-01-16 

Adam
God... please help me become the person my dog thinks I am.

Re: Deleting linked rtf and image files after confirmation?

Hi Derek,


If and when u have a time could u have a look at the issue on post #1 above please?

Adam
God... please help me become the person my dog thinks I am.

3 (edited by domebil 2021-01-19 18:18:51)

Re: Deleting linked rtf and image files after confirmation?

check now

Post's attachments

Attachment icon Adam_SavingRTFasLINKED 3 Delete after Confirmation ok.rar 297.49 kb, 227 downloads since 2021-01-19 

Domebil

4 (edited by derek 2021-01-19 21:08:05)

Re: Deleting linked rtf and image files after confirmation?

Hi Adam,
I just added a 'confirmation' button and a corresponding procedure in the script - if 'okay' is clicked, it then clicks the original 'delete' button (which is now hidden).  Seemed the easiest way without disturbing anything else.
Derek.

Post's attachments

Attachment icon filedelete from copyfile folder.zip 340.24 kb, 227 downloads since 2021-01-19 

Re: Deleting linked rtf and image files after confirmation?

Hi Domebil,
Thank you very much for the reply. I already have tried onAfterClick event. It deletes linked RTF file but not linked image file.

--------------------------------------

Hi Derek,
Thank you very much for the sample project. It certainly contain very useful stuff for me which will be useful in future projects. In this case, I'm trying to delete all of the selected record together with linked files after confirmation dialog using a delete button on form 1. Could it be done? If so could you please show on the sample project I posted above.

Adam
God... please help me become the person my dog thinks I am.

Re: Deleting linked rtf and image files after confirmation?

Hi Adam,
Perhaps do it as per the attached.
Derek.

Post's attachments

Attachment icon filedelete from copyfile folder3.zip 339.43 kb, 222 downloads since 2021-01-21 

Re: Deleting linked rtf and image files after confirmation?

Thank you very much Derek........
As always your kind help truly appreciated.........


I have used the following, which seems to be working OK. Disabled default delete confirmation

procedure Form1_Button2_OnClick (Sender: TObject; var Cancel: boolean);
begin
if messagedlg('Are you sure you want to delete the Record and any Attachments?', mtconfirmation, mbyes+mbno,0) = mryes then
   begin
   deletefile(extractfilepath(application.exename) + form1.edit1.text);
   form1.richedit1.clear;
   form1.richedit1.deselect;
   form1.edit1.clear;

   deletefile(extractfiledir(application.exename) + Form1.DBImage1.dbField);
   deletefile(extractfiledir(application.exename) + sqlexecute('select img01_filename from test where id =' +form1.tablegrid1.sqlvalue));
   form1.DBImage1.clear;
   Form1.button3.click;
   end;
end;
Adam
God... please help me become the person my dog thinks I am.