Dear friends,
First off all I want to ask you all to excuse me about my silence into last two days. I had a specially event into family (actually was my niece's christening) so I must keep away from my computer.
Second I must tell you that english is not my native language so I am afraid that you didn't understand my problem.
So, I have a form, a grid and a "Save" button on it (initially "Disabled"). In grid I have some columns with CheckBox inside.
The requirements is that when it change the values of one or more checkbox's from one or more records, the state of the "Save" button to be change from "Enabled" to "Disabled" or from "Disabled" to "Enabled".
In other words, if I change the values for Check1 or Check2, the state for "Save" will be "Enabled" and if I change back the values to the initial, the state will be again "Disabled".
So, I mind that for achievement of the requirements, I must calculate a CheckSum for each record and store it. When I click onto one CheckBox, I calculate again the CheckSum and compare it with the initial one.
With my ideas and your help, now, I have the following solution. It works, but I wonder if there is another solution maybe more simple.
In the Init method of the Form:
Code:
lcRecordSource = "Select ... SPACE(32) as CheckSum, .F. as WasModified ";
+ "FROM ... ";
+ "INNER Join ... ";
+ "WHERE ... = ";
+ "INTO Cursor Temp Readwrite"
Thisform.Grid1.RecordSource = lcRecordSource
If _Tally <> 0
Select Temp
Locate
Do While Not Eof()
lcCheckSum = Sys(2017, "CheckSum, WasModified", 1, 1)
Replace Temp.CheckSum With lcCheckSum
Skip
Enddo
Locate
Endif
In the Grid1.Column3.Check1.Click and so on:
Code:
lcCheckSum = Sys(2017, "CheckSum, WasModified", 1, 1)
If lcCheckSum <> Temp.CheckSum
Replace Temp.WasModified With .T.
Else
Replace Temp.WasModified With .F.
Endif
Thisform.Refresh
In the Refresh method of the Form:
Code:
Select WasModified From Temp Where Temp.WasModified = .T. Into Cursor crWasModified
If _Tally = 0
Thisform.commandgroup1.Save.Enabled = .F.
Else
Thisform.commandgroup1.Save.Enabled = .T.
Endif
Select Temp