What to do when, when opening a stack?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 489
Joined: Thu Sep 04, 2008 6:23 am

What to do when, when opening a stack?

Post by jameshale » Mon Oct 25, 2021 6:31 am

Hi,

I am wondering if it is written down somewhere what you can do, or more specifically what you shouldn't do when opening a stack/standalone.
As I understand it the order would be ...

preopenstack
openstack
peropencard
opencard

for example:
If I need to check the presence of a pref file on the user's disk would the preopenstack be the place to do it? If so, are custom properties and global variables available to me at that time?

stam
Posts: 3072
Joined: Sun Jun 04, 2006 9:39 pm

Re: What to do when, when opening a stack?

Post by stam » Mon Oct 25, 2021 8:10 am

Hi James,

my understanding is that functions that rely on the common library (such as revCopyFile) won't work if called so early in the process that the common library hasn't loaded (eg in preOpenStack).

According to the documentation:
In a standalone application the Common library is implemented as a hidden group and made available when the group receives its first openBackground message. During the first part of the application's startup process, before this message is sent, the revCopyFile command is not yet available. This may affect attempts to use this command in startup, preOpenStack, openStack, or preOpenCard handlers in the main stack. Once the application has finished starting up, the library is available and the revCopyFile command can be used in any handler.
Other than that everything should work i think... (or there'd be little point in the handlers ;) )
S.

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 489
Joined: Thu Sep 04, 2008 6:23 am

Re: What to do when, when opening a stack?

Post by jameshale » Mon Oct 25, 2021 8:16 am

Thanks stam, I will look at what is in the common library stack.

Post Reply