Topic: Safeguard symbol
Hi all, how to have a symbol of backup of the program which is displayed on the screen to warn the user that the backup of his data is carried out.
Sabine
My Visual Database → General → Safeguard symbol
Hi all, how to have a symbol of backup of the program which is displayed on the screen to warn the user that the backup of his data is carried out.
Sabine
Hello sdpc
What do you mean by symbol? An image, an icon, a message?
You can use a MessageBox with its appropriate icon, create your own message box.
Give us more clarification
JB
Yes, an image that appears when the backup is in progress.
Hi all, how to have a symbol of backup of the program which is displayed on the screen to warn the user that the backup of his data is carried out.
Sabine
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
Stream1, Stream2: TFileStream;
begin
Form1.SQLConnection.Connected := False;
Stream1 := TFileStream.Create ('sqlite.db', fmOpenRead);
try
Stream2 := TFileStream.Create ('Backup\backup '+ FormatDateTime('dd-mm-yyyy', now)+'.db', fmOpenWrite or fmCreate);
try
Form1.Panel1.Color := clGreen;
Stream2.CopyFrom (Stream1, Stream1.Size);
finally
Stream2.Free;
end;
finally
Stream1.Free;
Form1.SQLConnection.Connected := True;
Form1.Panel1.Color := clBtnFace;
end;
end;
Thank you very much Vladimir, your code works to save the data but does not display an image during the save. I would like an image or an icon to be displayed during the backup to warn the user of the program.
Thank you very much Vladimir, your code works to save the data but does not display an image during the save. I would like an image or an icon to be displayed during the backup to warn the user of the program.
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
Form1.Image1.Picture.LoadFromFile('icons8_Copy_52px.png');
if (CopyFile('sqlite.db','Backup\Backup_sqlite.db',False)) then
Form1.Image1.Picture.LoadFromFile('icons8_Copy_52px_1.png') else
Form1.Image1.Picture.LoadFromFile('icons8_Copy_52px_2.png');
end;
Thanks for the reply, I would like to know what "icons8_Copy_" is because I can't display the image when the backup starts. Can you explain to me please?
Hi Sabine, Hi Vladimir,
'Icons8_Copy_' are simply the names of two image files that Vladimir has used to display the status of the back-up job.
Just replace the image filenames that Vladimir uses with your own files.
Derek.
Great, it works. Is it possible to make it disappear after a few seconds, while the backup is done.
Hi Sabine,
I'd probably try to incorporate a simple splash screen as a timed event (see the attached as an example) into the code that Vladimir has already written for you.
Derek.
Thanks Derek, thanks Vladimir, I included the timer in my program and when I click on the save button the timer runs until the green button appears which means the save has been done.
Thank you so much.
Sabine
How can I do to display an image on the main form and close it after some time. I manage to make it appear but I can't close it, I must be wrong somewhere.
Sabine
How can I do to display an image on the main form and close it after some time. I manage to make it appear but I can't close it, I must be wrong somewhere.
Sabine
in the timer, check if the file sizes are the same
if YES then close the form
Here is an example of my program, I would like the "Backup" image to close after the time has elapsed but I can't. Can you help me please.
Hi Sabine, Hi Vladimir,
For some reason, you have deleted the following instruction from your script:
application.processmessages;
This is what is preventing the image from closing.
Try it something like the attached (I have included a file size check as suggested by Vladimir).
I would be careful with the way you are doing all your processing on Form1 - it is very easy to hit 'enter' / 'save' accidently and create duplicate entries; to try and prevent this from happening, perhaps you could make versements.somme mandatory and clear form1.edit1 when 'enter' or 'save' is pressed
Derek.
Great, thanks Derek, I was stuck on that one. Thank you so much.
Hi all,
Because of the nature of SQLite, it's not a good idea to compare sizes.
You can add multiple entries and the size will not change.
This will not give a full guarantee that the process has passed.
It's better to compare the time if it's really important.
Hi all,
Because of the nature of SQLite, it's not a good idea to compare sizes.
You can add multiple entries and the size will not change.
This will not give a full guarantee that the process has passed.
It's better to compare the time if it's really important.
I agree about the size, but the modification time is not a reliable indicator of data modification, since when using standard authorization, the login time is recorded at each login, and other data may not change. Therefore, I make daily backups at the first start and keep copies for 5 days, the old ones are automatically deleted.
Hello Sabine, Vladimir, Sparrow, Konstantin (and anyone else!),
In the past, I have used
sqlexecute('select total_changes()')
to detect if any changes have been made to determine if I need to perform a back-up or not.
If so, you could then automate it on a 'form_close' procedure rather than relying on users to do it manually (they say they will but they never do!).
Maybe this is of interest.
Derek.
Your code works wonderfully. I would also like to put a progress bar on the form to view the backup, any idea?
Your code works wonderfully. I would also like to put a progress bar on the form to view the backup, any idea?
Maybe someone knows a script for reading and writing in blocks or by bits...?
Может кто знает скрипт для чтения и записи по блокам или по битам...?
mybe this link can help for make progressbar
http://myvisualdatabase.com/forum/viewt … 020#p25020
or
http://myvisualdatabase.com/forum/viewtopic.php?id=553
It's exactly what I needed. Thank you all for your efforts, you are on top.
Sabine
My Visual Database → General → Safeguard symbol
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi