Is it possible to get rid of The Save Stack Dialog?

Todd Geist todd at geistinteractive.com
Sun Jun 5 16:17:53 EDT 2011


Thanks Jan

On Sun, Jun 5, 2011 at 11:08 AM, Jan Schenkel <janschenkel at yahoo.com> wrote:

> --- On Sun, 6/5/11, Todd Geist <todd at geistinteractive.com> wrote:
> > Hello
> >
> > How does one stop the Save Stack Dialog that pops up in the
> > IDE when ever
> > you close a stack? In my testing On closeStackRequest
> > doesn't fire until
> > AFTER the dialog pops up and the user clicks "Save", So
> > doing this
> >
> > *on* closeStackRequest
> >
> >    *save* this stack
> >
> >    *pass* closeStackRequest
> >
> > *end* closeStackRequest
> >
> > Doesn't work.
> >
> > I am using LiveCode 4.6.1
> >
> > Thank you
> >
> > Todd
> >
>
> Hi Todd,
>
> As you said, the dialog box only pops up in the IDE.
>
> This is done as follows:
> - there is a frontscript aptly named 'revFrontscript' which traps the
> 'closeStackRequest' message and immediately executes the
> 'revIDEHandleCloseStackRequest' command
> - this command is actually part of a backscript named 'revBackscript',
> which uses another function 'revSaveCheck' in the same script to determine
> if the stack was edited and if so, show the 'Do you want to save changes'
> dialog box
> -> this in turn may call the 'revSave' or 'revSaveAs' command in the same
> backscript, which shows the fancy 'Saving' palette
>
> So the only way to prevent this dialog from popping up, is inserting your
> own backscript to trap this 'revIDEHandleCloseStackRequest' before it gets
> to the 'revBackscript' so you can suppress normal handling if it's your
> stack.
>
> Create a button in your project stack, name it something like
> 'NoSaveDialogBackscript' and set its script to:
> ##
> command revIDEHandleCloseStackRequest pTarget
>   -- closeStackRequest is sent to the current card of the stack
>   -- so we can derive the name of the stack from pTarget
>   local tTargetStack
>   put the owner of pTarget into tTargetStack
>   if the cThisStackDoesItsOwnSaving of tTargetStack is "true" then
>      return "pass"
>   end if
>   -- if it's not our stack, let the IDE do its thing...
>   pass revIDEHandleCloseStackRequest
> end revIDEHandleCloseStackRequest
> ##
>
> Next, you'll need to make sure this backscript is loaded at startup of your
> project stack, so add the following to its stack script:
> ##
> on openStack
>   insert the script of button "NoSaveDialogBackscript" of card 1 of me \
>       into front
>   -- always play nice and pass the message
>   pass openStack
> end openStack
> on closeStack
>   remove the script of button "NoSaveDialogBackscript" of card 1 of me \
>       from front
>   -- always play nice and pass the message
>   pass closeStack
> end closeStack
> ##
>
> Finally, set the cThisStackDoesItsOwnSaving custom property of your project
> stack to "true" - now save everything, close LiveCode, re-open it and your
> stack, and from now on, all should work as you like.
>
> Caveat: if the RunRev engineers change the name of the command in the next
> release of LiveCode, you'll have to update your backscript, but that's the
> way the cookie crumbles :-)
>
> HTH,
>
> Jan Schenkel.
> ====
> Quartam Reports & PDF Library for LiveCode
> www.quartam.com
>
> ====
> "As we grow older, we grow both wiser and more foolish at the same time."
>  (La Rochefoucauld)
>
>
> _______________________________________________
> 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
>


Todd Geist
------------------------------
geist interactive <http://www.geistinteractive.com>
805-419-9382



More information about the use-livecode mailing list