Page 1 of 3

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

Posted: Thu Dec 02, 2010 12:39 pm
by Dixie
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

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

Posted: Fri Dec 03, 2010 1:05 am
by dunbarx
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

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

Posted: Fri Dec 03, 2010 1:29 pm
by Dixie
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

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

Posted: Sun Dec 05, 2010 11:51 am
by Mark
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

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

Posted: Mon Feb 05, 2024 11:17 am
by Zax
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 ?

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

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

Code: Select all

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

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

Posted: Mon Feb 05, 2024 1:45 pm
by Zax
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. :(

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

Posted: Mon Feb 05, 2024 2:13 pm
by Klaus
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?

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

Posted: Mon Feb 05, 2024 2:47 pm
by Zax
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.

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

Posted: Mon Feb 05, 2024 3:34 pm
by stam
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

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

Posted: Mon Feb 05, 2024 6:56 pm
by jacque
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.

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

Posted: Mon Feb 05, 2024 6:59 pm
by stam
Thanks Jacque, nice to know!

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

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

Posted: Tue Feb 06, 2024 9:36 am
by Zax
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.

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

Posted: Tue Feb 06, 2024 6:56 pm
by jacque
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

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

Posted: Wed Feb 07, 2024 9:09 am
by Zax
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.