Setting a dirty flag for a file
Richard Gaskin
ambassador at fourthworld.com
Thu Jul 21 15:20:16 EDT 2011
Charles Szasz wrote:
> I am using Rev. 4.0. How do you set a "dirty flag" for a data
> file that that has been saved but still open in your app stack?
> My app creates a data file that saves the contents of 16 fields.
> I have code to show an initial save dialog when the user makes
> changes. I want to use a dirty flag to show another save box only
> when closing the file if the user makes subsequent changes in the
> data file. Otherwise when the user closes the data file without
> additional change no save dialog will be presented.
You can use a custom property for that, setting it to true whenever a
closeField triggers, and clearing it on save.
But better still would be to use the modifiedMark property of the stack,
which has the additional benefit of indicating unsaved changes by
darkening the closeBox on OS X.
Whichever flag you use, you'll want to check it in a closeStackRequest
handler, so you can prompt the user to save if needed.
--
Richard Gaskin
Fourth World
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
More information about the use-livecode
mailing list