cannot see custom properties after close/reopen

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: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

cannot see custom properties after close/reopen

Post by markhinnebusch » Wed Jun 06, 2018 11:39 pm

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

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

Re: cannot see custom properties after close/reopen

Post by Klaus » Thu Jun 07, 2018 11:12 am

Hi Mark,

not sure what's going on...

You wrote:
...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.
Unless the CPs have been in that new stack from the server, I'd exspect this stacks CPs to be "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

markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

Re: cannot see custom properties after close/reopen

Post by markhinnebusch » Thu Jun 07, 2018 3:37 pm

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

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

Re: cannot see custom properties after close/reopen

Post by Klaus » Thu Jun 07, 2018 4:01 pm

Hi Mark,

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
...
before loading the new stack.
Sorry, no other brilliant idea...

Best

Klaus

bogs
Posts: 2283
Joined: Sat Feb 25, 2017 10:45 pm

Re: cannot see custom properties after close/reopen

Post by bogs » Thu Jun 07, 2018 4:16 pm

Klaus wrote:
Thu Jun 07, 2018 4:01 pm
if the "destroystack" and "destroywindow" of the stack is set to TREU, then this should not happen.
Guess this answers the question of whether or not it is difficult to spell short words, like 'Klaus', which is far more difficult than 'TRUE' :twisted:
<ducking>
Image

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

Re: cannot see custom properties after close/reopen

Post by Klaus » Thu Jun 07, 2018 4:17 pm

Ouch, touché!

At least TREU is german for "faithful" :-D

bogs
Posts: 2283
Joined: Sat Feb 25, 2017 10:45 pm

Re: cannot see custom properties after close/reopen

Post by bogs » Thu Jun 07, 2018 4:37 pm

:mrgreen: :mrgreen:
Image

markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

Re: cannot see custom properties after close/reopen

Post by markhinnebusch » Thu Jun 07, 2018 6:37 pm

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

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: cannot see custom properties after close/reopen

Post by jameshale » Fri Jun 08, 2018 2:02 am

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)?

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

Re: cannot see custom properties after close/reopen

Post by Klaus » Fri Jun 08, 2018 10:31 am

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

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: cannot see custom properties after close/reopen

Post by jameshale » Fri Jun 08, 2018 10:36 am

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6173
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: cannot see custom properties after close/reopen

Post by FourthWorld » Fri Jun 08, 2018 4:46 pm

Without seeing the code for the sequence any answer will be guesswork.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

Re: cannot see custom properties after close/reopen

Post by markhinnebusch » Fri Jun 08, 2018 4:55 pm

I was looking at individual custom properties, not sets.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6173
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: cannot see custom properties after close/reopen

Post by FourthWorld » Fri Jun 08, 2018 4:58 pm

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
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

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

Re: cannot see custom properties after close/reopen

Post by jacque » Fri Jun 08, 2018 5:09 pm

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

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”