How to tell if a stack has been edited
Richard Gaskin
ambassador at fourthworld.com
Wed Mar 28 11:13:18 EDT 2007
Devin Asay wrote:
> On Mar 27, 2007, at 10:23 PM, Sarah Reichelt wrote:
>> Is there any way to tell if the data in a stack has been edited? I
>> don't want to have to keep track of every field and record any changes
>> so I am hoping there is a hidden property somewhere that can tell me
>> this. It has to work in a standalone, not just in the IDE.
>
> This is just a wild thought, but maybe it would work. We know that
> you can store anything in a custom property, including a stack. What
> if, when you open a stack, you have an invisible stack that copies
> that stack into a custom prop. Then, at certain intervals, or after
> certain events, that same invisible stack copies the currently open
> stack into another custom prop. At that point you could either
> compare their sizes using a length function, or even check the two
> custom props for equality.
You could even save space by just storing the MD5digest of the stack.
Unfortunately I don't think it's possible at this time without first
saving the stack file before the comparison, since we can use the
contents of a variable as a stack but we can't yet put a stack into a
variable except by reading it from disk.
I've submitted a BZ request for that:
<http://quality.runrev.com/qacenter/show_bug.cgi?id=577>
In the meantime, in my apps I just have a frontScript that traps for
things like closeField and flags the stack as needing to be saved.
While it takes some work to set up, it leaves me in total control over
what constitutes a savable action.
--
Richard Gaskin
Fourth World Media Corporation
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list