Close the stack and don't ask me to save changes...

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Close the stack and don't ask me to save changes...

Post by Dixie » Thu Dec 02, 2010 12:39 pm

Hi...

I have a stack that runs just fine... I open the stack in the IDE and use it, Ok... no problems.. but, when I have finished using the stack it always pops up the 'Do you want to savechanges to stack "xxx"...

How do I get to close or quit the stack so that this dialog never appears... in that I don't want changes making to the stack, but I don't wish to be asked the question... I can't work it out ?

confused

Dixie

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Close the stack and don't ask me to save changes...

Post by dunbarx » Fri Dec 03, 2010 1:05 am

Check out the "saveStackRequest" message in the dictionary. Untested, but closing the stack with a "close stack" command and trapping this message will likely do what you want.

Or at least give you a start.

Craig Newman

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Close the stack and don't ask me to save changes...

Post by Dixie » Fri Dec 03, 2010 1:29 pm

Craig...

Thanks.. I had used the 'saveStackReques't but found it not to work... I don't know what I was doing with it, but whatever it was didn't help... anyway after getting your reply, I went back to it ... then read the dictionary listing again and now all is well... thanks ! :)

be well

Dixie

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Close the stack and don't ask me to save changes...

Post by Mark » Sun Dec 05, 2010 11:51 am

Hi,

That's right, messages like saveStackRequest, closeStackRequest and shutDownRequest are sent to the IDE first. Worse, the IDE sends a message to a field in the topstack, thereby changing the variable gRevstackStatus[name of stack] and hence causing LC to ask you whether to change the stack or not.

There are still ways to do this. You can set the cantModify of your stack to true or open your stack as a modeless window.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Zax
Posts: 474
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Close the stack and don't ask me to save changes...

Post by Zax » Mon Feb 05, 2024 11:17 am

Hello,

14 years later with LC 9.6.11, I still have this problem!

If we lock the stack by setting its cantModify property to true, we do not have this annoying Save dialog when closing the stack but we cannot paste text into a field. :(
I tried to look at how the built-in revSearch stack was made but I didn't find anything special: it is in topLevel (like an ordinary stack) and I didn't find anything that sets its "cantModify" property to true.

Any ideas ?

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Close the stack and don't ask me to save changes...

Post by Klaus » Mon Feb 05, 2024 1:40 pm

Did you try:

Code: Select all

...
lock messages
close this stack
## or any other stack
...
?

Zax
Posts: 474
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Close the stack and don't ask me to save changes...

Post by Zax » Mon Feb 05, 2024 1:45 pm

Klaus wrote:
Mon Feb 05, 2024 1:40 pm
Did you try:

Code: Select all

...
lock messages
close this stack
## or any other stack
...
?
Yep Klaus, without success. :(

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Close the stack and don't ask me to save changes...

Post by Klaus » Mon Feb 05, 2024 2:13 pm

Hm, just made a test and that little script works for me, new stack with a field and a button,
no dialog after clicking, but I see this dialog when I use the red close button on my Mac.

When exactly do you see that dialog and what did you script so far?

Zax
Posts: 474
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Close the stack and don't ask me to save changes...

Post by Zax » Mon Feb 05, 2024 2:47 pm

Klaus wrote:
Mon Feb 05, 2024 2:13 pm
Hm, just made a test and that little script works for me, new stack with a field and a button,
no dialog after clicking, but I see this dialog when I use the red close button on my Mac.

When exactly do you see that dialog and what did you script so far?
We are agree: closing a stack in the IDE by script is OK. The problem is when closing the stack with the "red close" button.
Though, the revSearch stack has a default look, so it has a "red close" button but clicking on it doesn't trigger this annoying Save dialog.

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Close the stack and don't ask me to save changes...

Post by stam » Mon Feb 05, 2024 3:34 pm

Zax wrote:
Mon Feb 05, 2024 11:17 am
If we lock the stack by setting its cantModify property to true, we do not have this annoying Save dialog when closing the stack but we cannot paste text into a field. :(
I tried to look at how the built-in revSearch stack was made but I didn't find anything special: it is in topLevel (like an ordinary stack) and I didn't find anything that sets its "cantModify" property to true.
You raise an interesting question - how does the revSearch do this? As far as I can tell it behaves like a modeless stack, but reports being topLevel and like you looking at the card and stack script I cannot fathom how this is done...


Having said that, you can achieve this exact behaviour by setting the style of your stack to "modeless".
It will appear and behave like a normal topLevel stack, but can't be modified and will close without asking to be saved. Pretty much the same as a palette will do.
Dictionary wrote:A modeless dialog box behaves like an ordinary window, except that it cannot be edited. Use modeless dialog boxes to ask the user for information.

To edit a modeless dialog box, use the topLevel command to display it in an editable window.
Isn't this what you are trying to achieve? (instead of 'dialog box' read 'stack' in the quote above)

Stam

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Close the stack and don't ask me to save changes...

Post by jacque » Mon Feb 05, 2024 6:56 pm

LC sets a flag on a stack whenever any change happens, and if it's true then you get the dialog. The problem is that LC automatically places the insertion point in the first unlocked field when the card opens and that counts as a change whether you type anything or not. I submitted a bug report requesting a change to the behavior but so far no action on that.

LC does not apply the same rules to IDE stacks which is why the search stack doesn't show a dialog. If I remember right, LC traps the closeStackRequest message in a front script before passing it on to the stack, which is why it's difficult to avoid it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Close the stack and don't ask me to save changes...

Post by stam » Mon Feb 05, 2024 6:59 pm

Thanks Jacque, nice to know!

I believe a “modeless” stack probably fulfils the above request having said all that….

Zax
Posts: 474
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Close the stack and don't ask me to save changes...

Post by Zax » Tue Feb 06, 2024 9:36 am

Thank you Jacqueline for your explanations.

And thank you Stam: a modeless stack seems to be a good solution. :)

Now, I think LC is not very clear/convenient on this point:
- if a topLevel stack is set as cantModify, a "normal" (editable) field can be filled by typing manually in it but text can't be pasted. Worse, a save dialog appears when closing such a stack.
- to have a real "cantModify" stack, you have to set its style to modeless.

Concerning the "autoFocus" on first editable field when opening a card, it's very annoying since years. It should be a stack property in order to choose its behavior.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Close the stack and don't ask me to save changes...

Post by jacque » Tue Feb 06, 2024 6:56 pm

Zax wrote:
Tue Feb 06, 2024 9:36 am
Concerning the "autoFocus" on first editable field when opening a card, it's very annoying since years. It should be a stack property in order to choose its behavior.
Feel free to complain here, maybe they'll notice:
https://quality.livecode.com/show_bug.cgi?id=22790
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Zax
Posts: 474
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Close the stack and don't ask me to save changes...

Post by Zax » Wed Feb 07, 2024 9:09 am

jacque wrote:
Tue Feb 06, 2024 6:56 pm
Feel free to complain here, maybe they'll notice:
https://quality.livecode.com/show_bug.cgi?id=22790
Done.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”