needs saving

1 view
Skip to first unread message

Peter M. Brigham, MD

unread,
Nov 4, 2011, 10:04:59 AM11/4/11
to How to use LiveCode
Anyone know what the IDE uses to decide whether to ask about saving a stack when it closes? I'm trying to implement a "markDirty" routine for the Mac. I have a frontscript that catches (then passes) closefield and sets the modifiedMark of the stack, but that won't catch field contents modified by script, or changed customprops, etc, unless I comb through over 30,000 lines of code to find all the places where I change the contents of the stack, and insert a "markDirty" command. If I could intercept whatever message the IDE uses for this it would simplify things immensely.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


_______________________________________________
use-livecode mailing list
use-li...@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Mark Schonewille

unread,
Nov 4, 2011, 10:16:56 AM11/4/11
to How to use LiveCode
Hi Peter,

As soon as a field gets focused, revolution puts "edited" into gRevStackStatus[short name of this stack]. That's a very bad trick and means that your stack is almost always "edited".

A much better way is to calculate the hash of relevant data and compare this with a new hash value. If the two hash values are different, then you need to set the dirty flag.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Become our partner in sales http://qery.us/16r Start selling Color Converter today. 20% commission!

dun...@aol.com

unread,
Nov 4, 2011, 10:20:29 AM11/4/11
to use-li...@lists.runrev.com
Peter.


Does the "saveStackRequest" help"


Craig Newman

Peter M. Brigham, MD

unread,
Nov 4, 2011, 11:02:28 AM11/4/11
to How to use LiveCode
Right. Then I have to figure out what to hash, which is do-able. But it doesn't answer the most important question: I need to trap a general message to trigger this so as to set the dirty flag on the window. I suppose the backup plan would be a send-in-time handler to check the hash periodically -- this means the hashing test would have to be very fast so as not to interrupt user input perceptibly. To be really complete, I'd probably want to get the hash of the whole stack, but I can't find a way to do that. The sha1digest() and md5digest() functions both expect a string input. I'd hate to have to script a concatenation of all fields and customprops, and I'd have to comb through a bunch of scripts to make sure that that would capture all the possible changes a user could make anyway. Even if I solve those problems, I'm still looking for a message to trigger the thing, though.

-- Peter

Peter M. Brigham, MD

unread,
Nov 4, 2011, 11:04:13 AM11/4/11
to How to use LiveCode
Not so much, as it only gets triggered when closing the stack, and I want to set the dirty flag immediately when the user changes some content. Or as immediately as possible.

-- Peter


On Nov 4, 2011, at 10:20 AM, dun...@aol.com wrote:

> Peter.
>
> Does the "saveStackRequest" help"
>

Reply all
Reply to author
Forward
0 new messages