Re: on startup and on shutdown

2004-01-11 Thread Dar Scott
I have learned that somethings must be done in startup and somethings 
can't be done, but I don't remember which are which.  I also learned 
that it is not sent to the first card, but to the stack, or so it 
seemed.  I try to divide up things into app init and stack init and 
give stack init preference.

Dar Scott

___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: on startup and on shutdown

2004-01-11 Thread Frank Leahy
Tom,

If you're trying to store the property into a stack that resides on the 
CD, you're toast because the CD is read-only.

The only way to do what you want is to either:

1) Copy at least one stack to the user's disk and store the properties 
there, or

2) Create a preferences file where you store the property data on the 
user's disk, and read/write that prefs file on startup and shutdown.

As for using preOpenStack or a startup handler -- if you have a 
preOpenStack handler in your main stack, then you'll have to have an 
empty preOpenStack handler in each substack so that the main stack's 
preOpenStack handler is overridden.  Like this:

on preOpenStack
  -- This overrides the main stack handler.
  -- Do not call "pass preOpenStack" otherwise the main stack handler 
will get called.
end preOpenStack

Best,
-- Frank Leahy
On Sunday, January 11, 2004, at 01:56 PM, 
[EMAIL PROTECTED] wrote:

Either a custom prop can store info collected during use or if not,
then a sep stack needs to do it
Which one?
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: on startup and on shutdown

2004-01-11 Thread Thomas J McGrath III
Thanks, everyone, it seems to me the startup is what I wanted and the 
IDE does not process it 'in my stack' (which actually makes sense since 
it is a call only once message and REV already did that on it's 
startup).

I handled the startup not being loaded in the IDE by putting an if 
environment is "development" then do initialize in the preopenstack. 
This way I can leave the code in the app when built and it will switch 
to the startup instead.

I guess I misinterpreted the docs about the shutdown message. It sounds 
like it would be the best place to set a 'save' . I thought it was 
saying I could put variables into a custom prop and it would actually 
save it. What set me off was I was quitting in the IDE and it was 
saving my stack with the new data in the custom prop each time I tested 
it so in affect "I" was doing the saving and a build of course can not 
save itself with the new data.

Once again I  notice that I  put a lot of scripts into each handler 
that should be it's own function. This makes so much sense for reusing 
the script and yet I always seem to forget and end up with very long 
scripts.

THanks again,

TOm

On Jan 11, 2004, at 11:52 AM, Dom wrote:

Thomas J McGrath III <[EMAIL PROTECTED]> wrote:

My problem with the preopenstack is that I have a lot of substacks 
that
I don't want to use what is in the preopenstack handler. That is why
the startup looks so good.
In the substacks just put:

on preopenstack
end preopenstack
to trap this command.

As for "on startup", I was used to go with it in my HyperCard times, 
but
no more since then...

--
Digital photos (nature, garden) : http://cooldomi.free.fr/
Scripting : http://domiscript.free.fr/
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Macintosh PowerBook G-4 OSX 10.3.1, OS 9.2.2, 1.25 GHz, 512MB RAM, Rev 
2.1.2

Advanced Media Group
Thomas J McGrath III• 2003 •  [EMAIL PROTECTED]
220 Drake Road, Bethel Park, PA 15102


___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: on startup and on shutdown

2004-01-11 Thread Dom
Thomas J McGrath III <[EMAIL PROTECTED]> wrote:

> My problem with the preopenstack is that I have a lot of substacks that
> I don't want to use what is in the preopenstack handler. That is why
> the startup looks so good. 

In the substacks just put:

on preopenstack
end preopenstack

to trap this command.

As for "on startup", I was used to go with it in my HyperCard times, but
no more since then...

-- 
Digital photos (nature, garden) : http://cooldomi.free.fr/
Scripting : http://domiscript.free.fr/
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: on startup and on shutdown

2004-01-11 Thread Martin Baxter
>Thomas J McGrath III wrote>
>I just found the on startup and on shutdown handlers. I have tried to
>clean up my CD project by putting the initializers into these handlers.
>The docs say that is what they are for.
>
>Has anyone used these that much?

I use on startup and rely on it.
It's true that it doesn't run in the IDE, only in a standalone. So what I
do, in outline is...

on startup
  # do things that only need to be done when run as a standalone
  initialise
end startup

on initialise
  # read prefs files, set up global environment etc.
  if the environment  "development" then
  # do things that only need doing in the IDE
  end if
end initialise

Rather than use a preopenstack handler to run initialise automatically in
the IDE (which has potential problems you have found out already by the
sound of it), I either run initialise from the message box by hand, or
sometimes include a temporary (during development) menu item to run it.

The latter approach can sometimes be handy when testing a standalone, as it
allows you to reinitialise - should you need to - without having to quit
and relaunch the application.

Of course that menu item would be removed from a published build.

shutdown I never used, but actually I think it might be a good idea of I did.
It looks like probably the most logical point to save an application's
session state variables to disk.

Martin


___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: on startup and on shutdown

2004-01-11 Thread Klaus Major
Hi Thomas,

...
And "closestack" or "closestackrequest" or something the best place  
to cleanup things
before you leave...
My problem with the preopenstack is that I have a lot of substacks  
that I don't want to use
what is in the preopenstack handler. That is why the startup looks so  
good.
The docs say it is only called once but each time I open a substack it  
'reloads'
all of the things in the main stack's preopenstack which I don't want  
to happen.
In this case you can put your "preopenstack"-handler into the  
card-script of the first card!
This way  the substacks will not execute this handler :-)

...
http://lists.runrev.com/pipermail/use-revolution/2003-December/ 
026781.html
Thanks for the link. I was aware of that discussion. But the docs say  
you can store info
in a custom prop on shutdown. They even say that 'that is what the on  
shutdown and
on startup are for'. They don't say "But wait, you then have to save  
the custom prop in
a separate stack etc.!

That was why I asked, because after reading the thread you reference  
before I thought
that that was the only way BUT then I read in the docs that you can do  
it in a custom prop
Well, fact is standalones CANNOT save themselves!

In this case you will have to store your info/prefs outside the  
standalone...

And saving in the folder where the standalone resides may cause  
permission-problems
on OS X, Linux and Win2000 & XP...

You could create an invisible stack, give it a name, store your  
info/customprops in that stack
and save it in the appropriate folder using my function.

This way you have almost unlimited space to store info at once!
Since any new stack will automatically have one card, you can use the  
stack or card
customprops and additionally their custompropertysets!

I call it "storeprefs" here in my example.
"safe_place_to_store_my_bloody_prefs" is definitively too long :-)
When your app starts you can check with my function if there is already  
a prefs-file, then
read the customprop(s) of that file and do whatever you want with this  
info :-)

on preopenstack
  if there is a file (storeprefs() & "yourprefs.prf") then
put the myinfo of stack (storeprefs() & "yourprefs.prf") into xyz
## do whatever you want with xyz
  else
## do whatever you like, since this is probably the first start of  
your app
## on the end-users computer ;-)
  end if
  ...
end preopenstack

And on "closestack" or whenever you can do this:

on closestack
  ##collect your info into xyz...
   if there is a file (storeprefs() & "yourprefs.prf") then
 ## even no need to add the REV suffix
 set the myinfo of stack (storeprefs() & "yourprefs.prf") to xyz
 save stack (storeprefs() & "yourprefs.prf")
  else
   create invisible stack "myprefs" ## or whatever
   set the myinfo of stack "myprefs
   save stack "myinfo" as (storeprefs() & "yourprefs.prf")
  end if
...
end closestack
You get the picture ;-)

!!!Not tested, but should work...
(Famous last words ;-)
Hope that helps...

Regards

Klaus Major
[EMAIL PROTECTED]
www.major-k.de
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: on startup and on shutdown

2004-01-11 Thread Graham Samuel
On Sun, 11 Jan 2004 08:19:00 -0500, Thomas J McGrath III 
<[EMAIL PROTECTED]> wrote:

I just found the on startup and on shutdown handlers. I have tried to
clean up my CD project by putting the initializers into these handlers.
The docs say that is what they are for.
Has anyone used these that much? I don't think they load when the stack
is launched in the IDE. I think they only run in the final build.
Does anyone know for sure? I had to put the code in both the startup
and preopen stack handlers. In the preopenstack I put an 'if the
environment is "development" then do the same code as in the startup
handler.
Also related to this, I was reading the docs and they say if you want
to keep a preference set to load the variables into a custom property
on shutdown and then reload the custom prop into the variable on start
up. I have not been successful in this in my CD. Also, I thought from
this list that the only way to save info was via a separate stack
outside the build. Seems a contradiction.
Has anyone done this? I need to test it in a simple stack.
Hi Tom

I always use a startup handler to initialise globals and other settings for 
the whole program, because it seems a very neat way to do it in the final 
app. I put the handler in the stack script of my first stack (usually a 
splash screen which acts as the repository for my common routines). It is 
true that it doesn't work in the IDE (presumably when the IDE is started it 
swallows the startup message on its own account), but you can get round 
that by typing

 send "startup" to stack "mySplash"

into the Message Box: another technique I have used is to have a button on 
a card which is only used during my development cycle (contains timing 
data, private logs and such) which just executes the script above. Late in 
the development cycle this card gets hidden or sent offscreen, but can be 
brought back easily enough if users report bugs.

The shutdown handler is invoked during the quit sequence, and in fact 
'shutdown' and 'shutDownRequest' are the only ways AFAIK to handle any 
shutdown actions you might want to perform under OSX, since the actual 
'Quit' menu item is taken out of your hands by the OS. It seems to me that 
'shutDownRequest' is superior to 'shutDown' because this gets sent when the 
OS demands that the application quits, at least on Mac systems (don't know 
how this differs from handling the aevtquit Apple Event, but that's another 
story).

I have no experience with custom property sets, but clearly the technique 
you mention will only work for a non-read-only stack, otherwise all changes 
will be lost...

HTH

Graham

---
Graham Samuel / The Living Fossil Co. / UK & France  

___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: on startup and on shutdown

2004-01-11 Thread Thomas J McGrath III
On Jan 11, 2004, at 8:38 AM, Klaus Major wrote:

Has anyone done this? I need to test it in a simple stack.
Check this for a quick guide:

http://lists.runrev.com/pipermail/use-revolution/2003-December/ 
026781.html
Thanks for the link. I was aware of that discussion. But the docs say  
you can store info in a custom prop on shutdown. They even say that  
'that is what the on shutdown and on startup are for'. They don't say  
"But wait, you then have to save the custom prop in a separate stack  
etc.!
That was why I asked, because after reading the thread you reference  
before I thought that that was the only way BUT then I read in the docs  
that you can do it in a custom prop

THanks anyway,

Tom
Regards

Klaus Major
[EMAIL PROTECTED]
www.major-k.de
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Macintosh PowerBook G-4 OSX 10.3.1, OS 9.2.2, 1.25 GHz, 512MB RAM, Rev  
2.1.2

Advanced Media Group
Thomas J McGrath III• 2003 •  [EMAIL PROTECTED]
220 Drake Road, Bethel Park, PA 15102


___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: on startup and on shutdown

2004-01-11 Thread Thomas J McGrath III
On Jan 11, 2004, at 8:38 AM, Klaus Major wrote:

Hi Thomas,

I just found the on startup and on shutdown handlers. I have tried to  
clean
up my CD project by putting the initializers into these handlers. The  
docs say that is what they are for.

Has anyone used these that much? I don't think they load when the  
stack is launched
in the IDE. I think they only run in the final build.
Does anyone know for sure? I had to put the code in both the startup  
and preopen
stack handlers. In the preopenstack I put an 'if the environment is  
"development"
then do the same code as in the startup handler.
I have no experience with "startup" but i would say that "preopenstck"  
IS the best place to
initialize everything...

And "closestack" or "closestackrequest" or something the best place to  
cleanup things
before you leave...
My problem with the preopenstack is that I have a lot of substacks that  
I don't want to use what is in the preopenstack handler. That is why  
the startup looks so good. The docs say it is only called once but each  
time I open a substack it 'reloads' all of the things in the main  
stack's preopenstack which I don't want to happen.



Also related to this, I was reading the docs and they say if you want  
to keep a preference
set to load the variables into a custom property on shutdown and then  
reload the custom
prop into the variable on start up. I have not been successful in  
this in my CD. Also, I thought
from this list that the only way to save info was via a separate  
stack outside the build.
Seems a contradiction.
No, it isn't.
Yes, it is!
No, it isn't.
Yes, it is!
No, it isn't.
Yes, it is!
No, it isn't.
Yes, it is!
No, it isn't.
Yes, it is!
Oh, c'mon this is not an argument, this is a contradiction...
etc...
Monty Python...
:-D
Contradiction or not, that's the way it works with "modern" OSs... ;-)
Which one is the way it works in "modern" OSs??
Either a custom prop can store info collected during use or if not,  
then a sep stack needs to do it
Which one?

Thanks Klaus,

Tom


Has anyone done this? I need to test it in a simple stack.
Check this for a quick guide:

http://lists.runrev.com/pipermail/use-revolution/2003-December/ 
026781.html

Thanks

Tom
Regards

Klaus Major
[EMAIL PROTECTED]
www.major-k.de
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Macintosh PowerBook G-4 OSX 10.3.1, OS 9.2.2, 1.25 GHz, 512MB RAM, Rev  
2.1.2

Advanced Media Group
Thomas J McGrath III• 2003 •  [EMAIL PROTECTED]
220 Drake Road, Bethel Park, PA 15102


___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: on startup and on shutdown

2004-01-11 Thread Klaus Major
Hi Thomas,

I just found the on startup and on shutdown handlers. I have tried to  
clean
up my CD project by putting the initializers into these handlers. The  
docs say that is what they are for.

Has anyone used these that much? I don't think they load when the  
stack is launched
in the IDE. I think they only run in the final build.
Does anyone know for sure? I had to put the code in both the startup  
and preopen
stack handlers. In the preopenstack I put an 'if the environment is  
"development"
then do the same code as in the startup handler.
I have no experience with "startup" but i would say that "preopenstck"  
IS the best place to
initialize everything...

And "closestack" or "closestackrequest" or something the best place to  
cleanup things
before you leave...

Also related to this, I was reading the docs and they say if you want  
to keep a preference
set to load the variables into a custom property on shutdown and then  
reload the custom
prop into the variable on start up. I have not been successful in this  
in my CD. Also, I thought
from this list that the only way to save info was via a separate stack  
outside the build.
Seems a contradiction.
No, it isn't.
Yes, it is!
No, it isn't.
Yes, it is!
No, it isn't.
Yes, it is!
No, it isn't.
Yes, it is!
No, it isn't.
Yes, it is!
Oh, c'mon this is not an argument, this is a contradiction...
etc...
Monty Python...
:-D
Contradiction or not, that's the way it works with "modern" OSs... ;-)

Has anyone done this? I need to test it in a simple stack.
Check this for a quick guide:

http://lists.runrev.com/pipermail/use-revolution/2003-December/ 
026781.html

Thanks

Tom
Regards

Klaus Major
[EMAIL PROTECTED]
www.major-k.de
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


on startup and on shutdown

2004-01-11 Thread Thomas J McGrath III
I just found the on startup and on shutdown handlers. I have tried to 
clean up my CD project by putting the initializers into these handlers. 
The docs say that is what they are for.

Has anyone used these that much? I don't think they load when the stack 
is launched in the IDE. I think they only run in the final build.
Does anyone know for sure? I had to put the code in both the startup 
and preopen stack handlers. In the preopenstack I put an 'if the 
environment is "development" then do the same code as in the startup 
handler.

Also related to this, I was reading the docs and they say if you want 
to keep a preference set to load the variables into a custom property 
on shutdown and then reload the custom prop into the variable on start 
up. I have not been successful in this in my CD. Also, I thought from 
this list that the only way to save info was via a separate stack 
outside the build. Seems a contradiction.

Has anyone done this? I need to test it in a simple stack.

Thanks

Tom

Macintosh PowerBook G-4 OSX 10.3.1, OS 9.2.2, 1.25 GHz, 512MB RAM, Rev 
2.1.2

Advanced Media Group
Thomas J McGrath III• 2003 •  [EMAIL PROTECTED]
220 Drake Road, Bethel Park, PA 15102
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution