cannot see custom properties after close/reopen
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 40
- Joined: Thu May 17, 2018 7:32 pm
- Location: Florida, USA
cannot see custom properties after close/reopen
I am trying to build an automated upgrade feature based on the splash screen method and I have it almost working (I think).
I have a stack (appState) with custom properties that include the version number of other stacks. When I startup,the splash stack saves all of the custom properties of the appState stack and then closes and clears the stack. the splash stack then renames the appState stack's file from appState.livecode by appending "old" to it, yielding appState.livecode.old. (for recovery if there is a problem). I then connect to the server and get a new version of the appState stack and I write that to a file with the original stack name, appState.livecode. I then open that stack. I want to compare the custom properties with those that I saved from the old version of the stack but the custom properties of the new stack are all empty. That is, if i put "answer the appName of stack appState into the message box, it displays nothing.
Except that they are there. If I use the stack inspector, I can see all of the properties and their values.
So, I'm stumped. Is there something that I need to do to let my script see the custom properties? I tried putting a 2 second delay in, but that did nothing. I closed and reopened the new stack. No change. If I close and reopen Live Code, then the properties can be seen by my script but I really don't want to make the user close and restart the app.
Any help will be greatly appreciated.
thanks,
mark
I have a stack (appState) with custom properties that include the version number of other stacks. When I startup,the splash stack saves all of the custom properties of the appState stack and then closes and clears the stack. the splash stack then renames the appState stack's file from appState.livecode by appending "old" to it, yielding appState.livecode.old. (for recovery if there is a problem). I then connect to the server and get a new version of the appState stack and I write that to a file with the original stack name, appState.livecode. I then open that stack. I want to compare the custom properties with those that I saved from the old version of the stack but the custom properties of the new stack are all empty. That is, if i put "answer the appName of stack appState into the message box, it displays nothing.
Except that they are there. If I use the stack inspector, I can see all of the properties and their values.
So, I'm stumped. Is there something that I need to do to let my script see the custom properties? I tried putting a 2 second delay in, but that did nothing. I closed and reopened the new stack. No change. If I close and reopen Live Code, then the properties can be seen by my script but I really don't want to make the user close and restart the app.
Any help will be greatly appreciated.
thanks,
mark
Re: cannot see custom properties after close/reopen
Hi Mark,
not sure what's going on...
You wrote:
However, since you only renamed the FILENAME of the stack, maybe the inspector still displays the OLD stacks content with FILLED custom properties?
LC still has problems with two or more stacks with the same name, although they have different IDs.
Best
Klaus
not sure what's going on...
You wrote:
Unless the CPs have been in that new stack from the server, I'd exspect this stacks CPs to be "empty"....get a new version of the appState stack and I write that to a file with the original stack name, appState.livecode. I then open that stack. I want to compare the custom properties with those that I saved from the old version of the stack but the custom properties of the new stack are all empty.
However, since you only renamed the FILENAME of the stack, maybe the inspector still displays the OLD stacks content with FILLED custom properties?
LC still has problems with two or more stacks with the same name, although they have different IDs.
Best
Klaus
-
- Posts: 40
- Joined: Thu May 17, 2018 7:32 pm
- Location: Florida, USA
Re: cannot see custom properties after close/reopen
Klaus,
Thanks for the quick response.
The stack from the server does have the CPs filled in and when i close LC and restart it, everything works fine. So, I'm guessing the problem is having the two stacks with the same name even though I close and clear the one before I open the other. I can try renaming the stack as well as the file and see if that helps. I'm also going to try to put the data into fields instead of CPs and see if that works. Can you think of anything else that I could do?
thanks,
mark
Thanks for the quick response.
The stack from the server does have the CPs filled in and when i close LC and restart it, everything works fine. So, I'm guessing the problem is having the two stacks with the same name even though I close and clear the one before I open the other. I can try renaming the stack as well as the file and see if that helps. I'm also going to try to put the data into fields instead of CPs and see if that works. Can you think of anything else that I could do?
thanks,
mark
Re: cannot see custom properties after close/reopen
Hi Mark,
if the "destroystack" and "destroywindow" of the stack is set to TREU, then this should not happen.
Maybe also issue:
before loading the new stack.
Sorry, no other brilliant idea...
Best
Klaus
if the "destroystack" and "destroywindow" of the stack is set to TREU, then this should not happen.
Maybe also issue:
Code: Select all
...
delete stack "name of troublemaker here"
## To completely remove that stack from memory
...
Sorry, no other brilliant idea...
Best
Klaus
Re: cannot see custom properties after close/reopen
Ouch, touché!
At least TREU is german for "faithful"
At least TREU is german for "faithful"
-
- Posts: 40
- Joined: Thu May 17, 2018 7:32 pm
- Location: Florida, USA
Re: cannot see custom properties after close/reopen
OK, I tried renaming the old stack and no dice. So then I tried using fields instead of CPs and that works.
So, the upshot is that when replacing a stack dynamically from a server, do not depend on CPs; use fields instead. At least for now. For me, this is no problem because the stack is never visible in the application since it serves only to contain application parameters. In fact, this made me realize that I can use the stack on the server to manage those parameters with a nice GUI. So it was a win-win.
thanks for the help,
Mark
So, the upshot is that when replacing a stack dynamically from a server, do not depend on CPs; use fields instead. At least for now. For me, this is no problem because the stack is never visible in the application since it serves only to contain application parameters. In fact, this made me realize that I can use the stack on the server to manage those parameters with a nice GUI. So it was a win-win.
thanks for the help,
Mark
-
- VIP Livecode Opensource Backer
- Posts: 474
- Joined: Thu Sep 04, 2008 6:23 am
- Location: Melbourne Australia
Re: cannot see custom properties after close/reopen
Isn’t a custom property set (i.e. properties, not a single property) an array?
Using “Answer” to display an array doesn’t show anything does it?
What if you ask to see the “keys” of your custom property (set)?
Using “Answer” to display an array doesn’t show anything does it?
What if you ask to see the “keys” of your custom property (set)?
Re: cannot see custom properties after close/reopen
Hi James,
Mark did not mention CP Sets at all, and "answer the whatever of this stack" DOES work for him, not just in the right moment.
Best
Klaus
Mark did not mention CP Sets at all, and "answer the whatever of this stack" DOES work for him, not just in the right moment.
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 474
- Joined: Thu Sep 04, 2008 6:23 am
- Location: Melbourne Australia
Re: cannot see custom properties after close/reopen
Hi Klaus,
He mentioned properties plural so i thought he may have them bundled as a set.
My reading of his post was that using ‘answer’ from the message box gave him nothing, which implied to me it did not work.
He mentioned properties plural so i thought he may have them bundled as a set.
My reading of his post was that using ‘answer’ from the message box gave him nothing, which implied to me it did not work.
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: cannot see custom properties after close/reopen
Without seeing the code for the sequence any answer will be guesswork.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 40
- Joined: Thu May 17, 2018 7:32 pm
- Location: Florida, USA
Re: cannot see custom properties after close/reopen
I was looking at individual custom properties, not sets.
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: cannot see custom properties after close/reopen
Does appState have to be a stack? If you're just using a stack as a container for properties an array may be simpler, completely bypassing any possibility of complications from stack name conflicts.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: cannot see custom properties after close/reopen
I have a huge project that fetches stacks remotely and each stack has hundreds of custom properties. I've never had a problem with them, so I suspect something else is going on, possibly in the handler that does the stack swap and renaming. It might help for us to see that script segment.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com