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
-
magice
- Posts: 457
- Joined: Wed Mar 18, 2009 12:57 am
Post
by magice » Sat Apr 18, 2009 2:52 am
I now have a splash screen .exe file that opens my stack. It works great in the standalone app. My saved files will open in runrev perfectly. But, there is a new set of problems. The first is loading that saved file into the stand alone app. I have to assume that I need to have my splash screen load them as well. So I have been trying to send a command back to the splash screen. in the openSavedFile script, I do this:
Code: Select all
Send openSavedFile to stack "OpenerStack"
Then in the splash screen file:
Code: Select all
on openSavedFile
answer file "Load Saved File"
if the result is "Cancel"
then exit openSavedFile
put it into tFileLoad
close stack "TemplateStack"
do "open stack " & quote & tFileLoad & quote
end openSavedFile
The answer file dialog comes up, so the command is getting to the splash screen stack properly, but the file never opens. I have also tried variations where I copy the file to a temp file and then load stack "temp"
the stack copies and is a working stack, but it just won't load. All I can guess is that it has something to do with loading a file with the same mainstack name. Is there a command for purging the old stack from the memory?
The next problem is in the splash screen executable file. When I close the application down, the process continues running, and I have to ctrl+alt+del to end it. Any help or suggestions would be greatly appreciated.
-
bn
- VIP Livecode Opensource Backer

- Posts: 4172
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sat Apr 18, 2009 10:09 am
The next problem is in the splash screen executable file. When I close the application down, the process continues running, and I have to ctrl+alt+del to end it. Any help or suggestions would be greatly appreciated.
Do you have a shutDownRequest handler that does not pass the shutDownRequest? Or anything else that intercepts the shutDown process?
Your first problem: I dont understand who is calling whom.
If you want to open from the splash stack then you should not have to ask for the file because it is with the exe and you just issue an open command.
What is the templatestack? If the templatestack is originating the
Send openSavedFile to stack "OpenerStack"
call then you close the calling stack before its handler finishes. The whole on openSavedFile is called from the templatestack which is still executing. Try
Code: Select all
send opensavedFile to stack "OpenerStack" in 1 milliseconds
not shure if this helps
regards
bernd
-
magice
- Posts: 457
- Joined: Wed Mar 18, 2009 12:57 am
Post
by magice » Sat Apr 18, 2009 1:07 pm
I guess this is a bit hard to understand from my description. My templatStack is the actual application in it's pristine unmodified state. The openerStack is my executable file. (The stack that gets saved to stand alone) Clicking the executable file works as it should. It loads the templateStack. After the end user modifies the template stack, they can save that stack as whatever they want to call it. That works fine. Where the problem comes in, is when the user wants to open that saved stack. From inside the templateStack, they choose Open file from the file menu and it sends the openSavedFile command back to the original executable file. The executable file asks for the file name unloads the original templateStack and is supposed to open the new user saved version of the templateStack. It does everything except actually loading the new file.
-
bn
- VIP Livecode Opensource Backer

- Posts: 4172
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sat Apr 18, 2009 3:14 pm
magice,
I tried your script on a standalone (the old mySplash)
When I do your command then it works for me. Even without send in x millisec.
It opens any stack you point it to. I did it from a button in the myDocumentStack. Since your get the answer dialog the exe gets the command. Do you have any funny on openstack/preopenstack commands that could interfere?
regards
Bernd
-
magice
- Posts: 457
- Joined: Wed Mar 18, 2009 12:57 am
Post
by magice » Sat Apr 18, 2009 4:42 pm
ok, thats a big help. just knowing that that script is correct got me looking in other directions. I think i have isolated the problem to a stack that shows on openCard.
Code: Select all
on openCard
global tShoweula
if tShoweula = "1"
then
show stack "eula"
modal stack "eula"
put "1" into tShoweula
end if
end openCard
there is more to the openCard script then that, but when I -- the modal line and show stack line out the load script works. The problem is, I need that to run at startup for the file being loaded to work properly. the if statement is there so that it only ever runs once.
-
magice
- Posts: 457
- Joined: Wed Mar 18, 2009 12:57 am
Post
by magice » Sat Apr 18, 2009 8:53 pm
I have played with the scripting and I have it loading a file. however when it loads the file, it actually comes up as the file that was just closed. I know the right file is getting designated to load, as I added an exta step. It now copies the file you want to load into a temp directory under the name temp.rev. it then opens temp\temp.rev. The temp file it creates is identical to the designated file, so that part is working. since the load command is now hardcoded to load stack "temp\temp.rev", the fact that it loads anything means it is getting the right file. but when it loads up, it is empty, just like the template stack. It seems to me that somehow the memory is not getting purged when the template stack is closed. so since the saved file has the same stack names it is just reloading the copy that was previously closed. Also, it seems to work fine in runrev (you just have to hit the purge button), but doesn't after saving the openerStack to stand alone. Any insight as to how to fix this is very welcome.
-
bn
- VIP Livecode Opensource Backer

- Posts: 4172
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sat Apr 18, 2009 9:20 pm
look at the destroystack property of a stack, that might be the problem
regards
bernd
-
magice
- Posts: 457
- Joined: Wed Mar 18, 2009 12:57 am
Post
by magice » Sun Apr 19, 2009 2:48 am
OMG I am pulling my hair out here. All the stacks destroystack property is true. what seems to be happening is an odd loop at open. I created a stack and put a button on it just to open one of my saved versions of the file. I got the purge dialog then the file opened. But the purge dialog was open again!! no matter how many times i hit purge, if alternates between the saved file and the empty template file. if i hit cancel 4 times it will end the purge loop but leaves me with a useless file. So I have been going over and over any opencard/openstack scripts. I even went as far as to eliminate them and it still does it. At this point, I am willing to pay someone to look at this and see what is happening.
-
bn
- VIP Livecode Opensource Backer

- Posts: 4172
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sun Apr 19, 2009 9:25 am
magice,
look what happens at closestack. Usually this happens, when the closestack or shutdownrequest is not passed properly. Something happens that when you close the templatestack that keeps it busy. Sometimes it help when you give the stacks different names and you set the title of the stack to what the user is supposed to see. Its time to clean up the code, I am afraid. Are there any substacks, that stay in memory because they were not properly closed, e.g. by preventing a closestack? You could also try to do a delete stack instead of closestack.
Once I ran into something you are experiencing and I never really got to solve it exept with this hack:
put this into your splashstack when trying to close the templatestack
Code: Select all
local tFileLoad
on openSavedFile
answer file "Load Saved File"
if the result is "Cancel"
then exit openSavedFile
put it into tFileLoad
closeTemplateStack
end openSavedFile
on closeTemplateStack
if there is a stack "templateStack" then
delete stack "templateStack"
send "closeTemplateStack" to me in 1 millisec -- you might increase this
else
openNewStack
end if
end closeTemplatStack
on openNewStack
open stack tFileLoad
end openNewStack
this is not nice and clean but it worked for me. It keeps deleting the templatestack until it is gone. For me it took 2 times to get the stack to close to really get offloaded from memory. I am not proud of this code but it was a last resort. Same problem you had that the names of the stacks were identical. If the structure of your project allows this then try to change the names of the stacks to different names. It makes life a lot easier. I did not realize the full impact of Revolutions limitation to keep two stacks with the same name in memory until I was very far down in a large project. So I resorted to this hack and never really cleaned up my code nor did I change the naming. Not proud of this, but it worked. (actually I did not have a splashScreen to do the work, I even created a temporary stack on the fly that did the closing and opening and then this stack closed itself with its destroy property set to true- horrible)
maybe this is of a little help and at least a bit of consolation
regards
Bernd
-
magice
- Posts: 457
- Joined: Wed Mar 18, 2009 12:57 am
Post
by magice » Sun Apr 19, 2009 3:36 pm
This just keeps getting more interesting. When I implemented the above code (genius in my opinion) I received the error "Cannot delete object templateStack" I took this to mean that some script of the stack was running. So, i targeted the most likely culprit, the substack "EULA" that gets the modal command on cardOpen. I nested another if statement into your closeTemplateStack script. That statement evaluates if there is a stack EULA and if so deletes it, and reruns itself until no stack "Eula" exists then continues with your original if statement. When i ran it it closed the stack but never opened the new one. So, to see what it was doing i put an answer command right before each delete command. "deleting EULA" and "deleting templateStack" what i get now, is alternating answer messages.
so what I can gather from this. since the "EULA" substack is given the modal command, the template stack cannot be deleted until that stack is gone. then somehow when i delete the templateStack it is reopening itself (or never gets deleted) with a new modaled EULA substack. What can cause a file to reload itself upon deletion? I really don't see how that is even possible.
-
bn
- VIP Livecode Opensource Backer

- Posts: 4172
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sun Apr 19, 2009 4:34 pm
magice,
try this in a very simple set of stacks that you have good control of. It should work.
Why it does not close is probably that you issue commands when closing that prevent exactly that.
For example where do you save. In my case I suspect it was that I was saving this stack all over the place, especially before closing. I never figured it out since it ran eventually.
Try this on a copy of your stacks to block everything that handles close shutdown and alike, like in the Card, Background, stack, substack etc.
Just to see what is causing this. You probably dont have to do it in the standalone. Just run your App as set of stacks. Are you using substacks? If you do look into the scripts of those (againg stack card etc.)
I am shure you will find the reason.
regards
Bernd
-
magice
- Posts: 457
- Joined: Wed Mar 18, 2009 12:57 am
Post
by magice » Sun Apr 19, 2009 6:20 pm
I solved a problem that was causing my EULA stack to open twice (once invisible and modaled). I thought for sure that would fix the problem, but it didn't. I have absolutely no commands that run at close. Saving is only done when the user actually chooses save from the menu. My intention is to eventually add a "You forgot to save " type dialog, but that does not exist yet. I have followed the logic trail for opening my stack till I can recite it by memory, and there is nothing left running. Yet I can open the app, go directly to the open file menu to open a saved version, and I get the error "Cant delete templateStack". I have checked the properties of every stack and every card or group of every stack. None of them are checked "can't delete" and all of them are checked "purge on close" is there anythin else that you can think of that could cause a stack to not be deletable.
-
bn
- VIP Livecode Opensource Backer

- Posts: 4172
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sun Apr 19, 2009 6:33 pm
magice,
I would try to recreate a bare bones setup like the one you have but just the splash screen, the templateStack and an option to close the templateStack and load another stack that has the same name but is in another location.
That should reduce the number of possible problems. See if you can get that to work, even as a standalone. Try without and with the modal EULA stack.
From what I gather the EULA stack is mostly for saving because you had problems saving except from a button script. (That actually has to be sorted out too, I can not believe that it only works from a button script)
good luck
Bernd
-
magice
- Posts: 457
- Joined: Wed Mar 18, 2009 12:57 am
Post
by magice » Sun Apr 19, 2009 9:53 pm
Well after a lot of prayer and design sacrifice I found a way. It isn't pretty but it works. My splash screen no longer auto loads the template file. It has two buttons, one for "New" and one for "Saved". Since the template file is no longer loaded first, the problem is gone. The user will just have to exit and start over if he wants to load a different file. someday when i am not in a time crunch to get this done before my 30 day trial runs out, and I have a licensed copy of RunRev I want to figure out what i did wrong. Until then I thank everyone for all the help and advice.