Setting a dirty flag for a file
Mark Schonewille
m.schonewille at economy-x-talk.com
Thu Jul 21 16:02:21 EDT 2011
Hi Charles,
I read your e-mail again. I understand that you want to know whether one or more fields have changed, not whether a file is open.
Usually, I generate an md5Digest and save that:
on closeField
makeDigest
end closeField
on makeDigest
put empty into myDigest
repeat with x = 1 to number of fields
put md5Digest(fld x & myDigest) into myDigest
end repeat
set the cDigest of this stack to myDigest
end makeDigest
function dataChanged
put empty into myDigest
repeat with x = 1 to number of fields
put md5Digest(fld x & myDigest) into myDigest
end repeat
return (the cDigest of this stack is myDigest)
end dataChanged
You just will have to figure out what is a smart event to check the digest: closing a field, closing a window, opening a window, refreshing the file menu, etc.
When you close the window, you might want to do this:
on closeStackRequest
if dataChanged then
answer "Do you want?" with "Don't Save" or "OK" or "No"
if it containt "Don't" then
exit closeStackRequest
else if it is "No" then
pass closeStackRequest
else
// do your saving stuff here
// return true if the file was saved
if the result is true then
pass closeStackRequest
end if
end if
end if
end closeStackRequest
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553
New: Download the Installer Maker Plugin 1.6 for LiveCode here http://qery.us/ce
On 21 jul 2011, at 21:35, Charles Szasz wrote:
> Devin and Mark,
>
> Thanks for your suggestions! I think this is one of those areas that should be covered by LiveCode in their Lessons. I would not be surprised that others had questions about how to do this task.
>
> Charles Szasz
> cszasz at mac.com
>
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list