Cannot really purge
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Cannot really purge
I am working on a series of instances of a stack. They live in different stack files, but have the same name. All of them have their destroyStack and destroyWindow set to "true".
But when I close one to play with one of its close relatives, I always have to dismiss the dialog that tells me that a stack of the same name is already open, and that I should purge the one I just closed.
i always do, but I wish I did not have to.
Also, when making a standalone, I always get the same dialog along the way.
So how does one really, truly knock a stack out of memory when closing it? I know quitting LC and re-opening is one way.
Craig
But when I close one to play with one of its close relatives, I always have to dismiss the dialog that tells me that a stack of the same name is already open, and that I should purge the one I just closed.
i always do, but I wish I did not have to.
Also, when making a standalone, I always get the same dialog along the way.
So how does one really, truly knock a stack out of memory when closing it? I know quitting LC and re-opening is one way.
Craig
Re: Cannot really purge
When you close it, are you hitting 'close and remove from memory', or just clicking the [x] (or close on the window) to close it?
If your in the IDE, the only way I know that is supposed to work is 'close and remove from memory'. In a standalone, then the destroy stack setting should do it.
If your in the IDE, the only way I know that is supposed to work is 'close and remove from memory'. In a standalone, then the destroy stack setting should do it.
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Cannot really purge
Bogs.
Aha. I had no idea what you were talking about until I looked in the "File" menubar. I rarely look in any menubar.
Anyway, I guess that is the answer, eh? But is there no way to invoke that menuItem? HC had its beloved "doMenu" command, something I sorely miss.
I am not even sure how to fake that with a plug-in. This ;
Craig
Aha. I had no idea what you were talking about until I looked in the "File" menubar. I rarely look in any menubar.
Anyway, I guess that is the answer, eh? But is there no way to invoke that menuItem? HC had its beloved "doMenu" command, something I sorely miss.
I am not even sure how to fake that with a plug-in. This ;
Code: Select all
on mouseUp
domenu "close and remove from memory" --does nothing
doMenu "close and remove from memory" of menu "file" --throws an error
end mouseUp
Re: Cannot really purge
Well, you can actually reach that 'close and remove from memory' in a number of ways in the IDE, the File menu as you found, or right clicking on the stack in either the Project or application browser.
As I might have mentioned before, I (am) learning this language in a fragmentary way, not my preferred way, which would be a manual similar to the one that came with Hc itself ( I read a great deal of it and it triggered fond memories of my old IBM manuals, which I still have but of course a lot of it is full of rabbit holes applied to Lc)
Hopefully someone with more familiarity with it will chime in at some point, unfortunately, I don't have a good answer
As of at least 6.x, the code for that menu item ran like this -
Now, you have been at this much MUCH longer than I, so maybe you can solve it ? I'm sure you follow it better than I do at any rate, I get the gist of it only at this point so I usually right click in the PB and choose it there.
As I might have mentioned before, I (am) learning this language in a fragmentary way, not my preferred way, which would be a manual similar to the one that came with Hc itself ( I read a great deal of it and it triggered fond memories of my old IBM manuals, which I still have but of course a lot of it is full of rabbit holes applied to Lc)
Hopefully someone with more familiarity with it will chime in at some point, unfortunately, I don't have a good answer
As of at least 6.x, the code for that menu item ran like this -
Code: Select all
case "Close and Remove From Memory"
if the mode of the topStack is not 1 then exit menuPick
put revBeforeRemovingStackFromMemory(the short name of the topStack) into tCheck
if tCheck is not empty then
answer error "Before Revolution can remove this stack from memory please:" & cr & cr & tCheck as sheet
exit menuPick
end if
set the defaultStack to the topStack
local tStackPath, tStackID
put the effective fileName of this stack into tStackPath
if tStackPath is empty then put the mainStack of this stack into tStackpath
local tMainstack
put the mainStack of stack tStackPath into tMainstack
local tSubstacks
put the subStacks of stack tStackPath into tSubstacks
local tStacks
put tMainStack & cr & tSubstacks into tStacks
answer warning "Really remove the stack file" && tStackPath && "from memory?" & cr & "Any changes made since saving will be lost from the following stacks:" & cr & cr & tStacks with "Cancel" or "OK" as sheet
if it is "Cancel" then
exit menuPick
end if
put the long id of stack tMainStack into tStackID
# OK-2008-08-18: Bug 6932 - Update the script editor here as messages is locked when deleting the stack
revIDEHandleObjectDeleted the long id of stack tMainStack
lock messages -- prevent user stack saving during the close, erasing substacks
repeat for each line tSubStack in tSubstacks
close stack tSubStack
end repeat
delete stack tMainStack
unlock messages
if the mode of stack "revApplicationOverview" is not 0 then
send "revRefreshTree" to stack "revApplicationOverview"
end if
send "refreshBrowser" to stack "revProjectBrowser" in 0 milliseconds
break
Re: Cannot really purge
While poking around the dictionary, I did find one bit that might work for a plugin,
You would have to poke around to figure out which is the correct menuItem, in this case [6] opened up a recent project I was working on
*Edit - took a few guesses, but I found it after all, at least as of Lc 6.5.2.
*Edit 2 - in 8.1.6 the actual line is
which you can execute from the message box. I think I'd stick with right clicking it though, really what are you saving doing it this way?
Code: Select all
select menuItem 6 of menu "File"
*Edit - took a few guesses, but I found it after all, at least as of Lc 6.5.2.
Code: Select all
on mouseUp
select menuItem 37 of menu "File"
end mouseUp
Code: Select all
select menuItem 40 of menu "File"
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Cannot really purge
With both destroystack and destroywindow set, it should purge itself. The IDE must be holding on to something. I usually just use either the contextual menu to remove the stack from memory or the message box. The command you need is "delete this stack".
Don't worry, it doesn't delete the file, just the copy in RAM.
Don't worry, it doesn't delete the file, just the copy in RAM.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Cannot really purge
I clicked my heels 72 times last night, and this morning my hopes were answered!
Thank you Jacque!
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Cannot really purge
@Jacque.
@Bogs.
I will try your idea when I get back to my office. This can be exploited with a plug-in, but, as per Jacque above, not sure why I have to.
Craig
Hmmm? Cannot my IDE just let it go and move on?The IDE must be holding on to something
@Bogs.
I will try your idea when I get back to my office. This can be exploited with a plug-in, but, as per Jacque above, not sure why I have to.
Craig
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Cannot really purge
Why?"doMenu" command, something I sorely miss
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Cannot really purge
The IDE does some complicated things under the hood and needs to clear all the references it keeps, which is what the menu item does. Using delete from the message box is kind of like throwing a bomb at the stack but I haven't seen anything bad happen. I do it all the time.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Cannot really purge
Jacque and I are holding hands on that one, I'm not sure why you'd have to either. We also agree (I think) that right clicking in either the AB or PB on the stack, then choosing close and remove is the far easier/better way to go.
Ultimately, though, her bomb throwing technique would sure work as well, and sounds much cooler
Re: Cannot really purge
Because if you go a bit further down to the comments, you see this -richmond62 wrote: ↑Wed Mar 07, 2018 6:32 pmWhy?"doMenu" command, something I sorely miss
doMenu.png
purge.png
When you try to use it for the 'close and remove' menu item, it errors out with can't find handler, obviously this is one of those that is not implementedComments:
The doMenu command is not implemented for all menu items. This command is included in LiveCode for compatibility with imported HyperCard stacks.
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Cannot really purge
Blast!this is one of those that is not implemented
But wait . . . IF the menu item is a pulldown menu one could try this:
send "menuPick Close and Remove From Memor&y" to btn "File" of stack "revMenubar"
[Don't ask me why 'someone' decided to slip an ampersand into the word "Memory"]
B*gger: just tried it, and cannot get that to work.
Probably because "Close and Remove From Memor&y" is NOT one word.
Re: Cannot really purge
The ampersand is to denote the key control, typical for most higher level languages. Like when you see "E&xit"
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Cannot really purge
&&&&&& Thank you
Why won't a send "menuPick" work?
Why won't a send "menuPick" work?