Home > Back-end >  Delphi7 small white the great god, genuflect is begged window closing remind save problem
Delphi7 small white the great god, genuflect is begged window closing remind save problem

Time:11-10

Form a stringgrid forms, remind save data before closing,
Now I set up a global variable record is saved, true is saved, false unsaved
Force true form creation time variable is initialized, did not press the save button before all of the operation is set to false, press the save button
Back to true,
Here's the thing, if after add delete content did not change after modification and so on a series of operations, but the variable
Also marked as false, a great god help!!!!!!
More than just registered, only 50 points, inclusion

CodePudding user response:

//in the OnClose event execute the following code: 
Procedure TForm1. FormClose (Sender: TObject; Var Action: TCloseAction);
The begin
If IsModified then//IsModified's global variables you said
The begin
Action:=caNone;
ShowMessage (' data has been modified, please save the data).
end;
end;

CodePudding user response:

reference 1st floor BlueStorm response:
//in the OnClose event execute the following code: 
Procedure TForm1. FormClose (Sender: TObject; Var Action: TCloseAction);
The begin
If IsModified then//IsModified's global variables you said
The begin
Action:=caNone;
ShowMessage (' data has been modified, please save the data).
end;
end;

You can't judge the content if there is any change, if I add a record, and deleted it, after operation and the content of the initial or the content of the last saved the same, then no save is close should be maintained without remind,
I only think of a way to earth, is the last time before closing and press the save button after compare the data, the same will directly closed, don't remind save, but such data more than a close to half a day program

CodePudding user response:

Only edited, regardless of whether or not the same as the original, is stored, so what's the problem?

CodePudding user response:

reference BlueStorm reply: 3/f
only edited, regardless of whether or not the same as the original, is stored, so what's the problem?

If the key is the data don't change don't want to remind the

CodePudding user response:

Every time increased to delete operations to judge whether there is a change,

CodePudding user response:

Don't need to get so complicated, changes have taken place in remind operation, changing the showmessage to yes/no selection dialog, allow the user to decide whether you need to save,

CodePudding user response:

The original poster is too axis, you open a document in word, change a word, to change back again, shut down, see tips you need to save the word?

CodePudding user response:

refer to 7th floor early play big play nuclear response:
the original poster is too axis, you open a document in word, change a word, to change back again, shut down, to see if the word you need to be saved?

Is so shaft , I'm really in the indigenous method, has built two stringlist, respectively to obtain the local TXT and compare the data in stringgrid, tried, roll roll keyboard seven or eight and ten records, almost no delay, anyway, where data is not much

CodePudding user response:

1/f, truth!!!!!!
  • Related