Re: How to tell when IDE is done loading

2014-12-28 Thread Michael Doub
Jacqueline, I do think that there is a timeing issue that you have to be 
aware of if you a calling revloadedstacks.

But something strange _IS_ going on.

Please create a stack and enter the script below into the stack script 
and save the stack and quit livecode.   Doubleclick on the stack icon.


You should see...

false
preOpenStack
true
Startup Complete

This is the expected behavior.   Note that the preOpenStack handler is 
called before the IDE home stack has finished initialization. This can 
clearly be seen if you watch the message box closely.


Now close the stack and remove it from memory and then open the stack.   
I do not get the expected behavior.  It seems that allowinterupts is set 
to false.   I get false on a clean start of livecode and checking 
allowinterrupts from the message box too.


Can you confirm what I am seeing or explain what is going on, or have I 
found a bug?  it appears to me that somewhere in the IDE, allowinterupts 
is being set to false again after the main startup code in the home 
stack resulting in the default state to be incorrect.


Regards,
   Mike


local ctr

on preopenstack
   put the allowinterrupts  cr
   send Mark_IDE_done to me in 2 ticks
   put preOpenStack  cr
end preopenstack

on Mark_IDE_done
   add 1 to ctr
   put  allowinterrupts  cr after msg
   if allowinterrupts = false then
  if ctr  25 then
 send Mark_IDE_done to me in 2 ticks
  end if
   else
  put Startup Complete  cr after msg
   end if
end Mark_IDE_done



On 12/27/14 11:29 AM, J. Landman Gay wrote:

I'm confused. LiveCode knows how to open a stack as part of its startup 
routine. Since  card 1 is always opened first, a preopenstack handler there 
will always fire and you can do your setup there from that card without 
worrying about timing.

On December 27, 2014 10:12:19 AM CST, Michael Doub miked...@gmail.com wrote:

Jacqueline and Mike, thanks for you help with this.

Just to clarify,  I am trying to solve the problem in the environment
where livecode is not running and the user double clicks on the
MasterLibrary stack.   This is not a standalone program but a stack
that
is being started from the desktop.  I am testing on a Mac, but I need
to
test on a PC to see if the behavior is any different.

Mike, I think you gave me a great clue.   The current logic in the
MasterLibrary is one where the preopenstack handler puts up a splash
screen and sends off a wakeup message to come back in 5 seconds.  I was

quite surprised to see how long it actually took the IDE to get
initialized.  This is way too long to wait if livecode is already up
and
running.

I added some debug code to display the allowinterupt state and found
that at the time my preopenstack handler messages gets called
allowinterupts is false, but in my wakeup hander the allowinterupts is
true.  This leads me to believe that I can monitor the allowinterupts
at
a faster frequency and do the actual wake up processing when I see it
go
true.

Regards,
 Mike


On 12/26/14 4:38 PM, Mike Bonner wrote:

It looks like the IDE load order is this:
System params are checked
libraries loaded
globals set
preferences set
icons loaded
patterns loaded
script editor loaded
user icon libraries loaded
error management loaded
tools loaded
menu bar loaded
app overview loaded
message box loaded
debugger loaded
quicktime loaded
plugins loaded
then revInternail_InitializeFinalSteps..
after that, there are still a couple things such as checking the

license

being used (community etc) and setting some os specific parameters.

The

very last thing (it seems) is the line set the allowinterrupts to

true

You can see this info in the script of stack home.rev, handler
revInternal_openStack.  Wonder if there is something in that script

you can

check to determine if the IDE is far enough along to do the things

you

need.


On Fri, Dec 26, 2014 at 1:31 PM, J. Landman Gay

jac...@hyperactivesw.com

wrote:


On 12/24/2014 11:57 AM, Michael Doub wrote:


I have tried that but I need to process the resumeStack message

which

seems to get called as part of the startup process.


Resumestack shouldn't be sent normally when a stack opens. There's a
difference between starting up a standalone and starting the IDE

though; it

may be that some of the IDE stacks need to deal with resumestack.

But your

own stack shouldn't need to.

   I guess I have to

manually set a global flag and have the timed handler unblock the
flag.   What is the very first handler that an application can

process?

Startup?


Again, it depends. In a standalone the first message is startup. The

stack

isn't fully loaded at that point so you can't manipulate stack or

card

objects yet but you can set global properties there.

But in the IDE, LiveCode itself catches the startup message and your

stack

will never receive it. The first message your stack will get is
preOpenStack.


   Is there an ordered list of messages that are fired for startup

and

opening a stack?  

Re: How to tell when IDE is done loading

2014-12-28 Thread Mike Bonner
Things are working correctly for me. 7.0.0, (since 7.0.1 still won't
install) When starting up the stack and IDE by opening the stack,false is
first.  After the IDE is fully open, allowinterupts seems to always be true
for me.

Not managing to duplicate the problem so far. I did adjust things so that
the ctr variable gets set to the message box too during the send loop, and
its always 1, which seems to indicate a simple send in time should be
sufficient. (send whatever to me in 0). Unless there is a wait with
messages somewhere along the line in that big startup handler I mentioned
in the previous post, the send that you do should be dumped at the end of
the queue and not fire until things are done.  (this is how people have
been getting around library loading problems.  Either a send to place the
call at the end of the queue, or using openstack or opencard instead since
they happen slightly later.)
IF you're getting allowinterups = false AFTER the IDE is fully open, (or
seems to be) something funky is going on.  Do you have any plugins?  Can
you take them out of the equation for now, then add them back in one at a
time?  That handler I mentioned also does copious logging, you might be
able to track down where the log is, and look at it.

On Sun, Dec 28, 2014 at 8:29 AM, Michael Doub miked...@gmail.com wrote:

 Jacqueline, I do think that there is a timeing issue that you have to be
 aware of if you a calling revloadedstacks.
 But something strange _IS_ going on.

 Please create a stack and enter the script below into the stack script and
 save the stack and quit livecode.   Doubleclick on the stack icon.

 You should see...

 false
 preOpenStack
 true
 Startup Complete

 This is the expected behavior.   Note that the preOpenStack handler is
 called before the IDE home stack has finished initialization. This can
 clearly be seen if you watch the message box closely.

 Now close the stack and remove it from memory and then open the stack.   I
 do not get the expected behavior.  It seems that allowinterupts is set to
 false.   I get false on a clean start of livecode and checking
 allowinterrupts from the message box too.

 Can you confirm what I am seeing or explain what is going on, or have I
 found a bug?  it appears to me that somewhere in the IDE, allowinterupts is
 being set to false again after the main startup code in the home stack
 resulting in the default state to be incorrect.

 Regards,
Mike


 local ctr

 on preopenstack
put the allowinterrupts  cr
send Mark_IDE_done to me in 2 ticks
put preOpenStack  cr
 end preopenstack

 on Mark_IDE_done
add 1 to ctr
put  allowinterrupts  cr after msg
if allowinterrupts = false then
   if ctr  25 then
  send Mark_IDE_done to me in 2 ticks
   end if
else
   put Startup Complete  cr after msg
end if
 end Mark_IDE_done



 On 12/27/14 11:29 AM, J. Landman Gay wrote:

 I'm confused. LiveCode knows how to open a stack as part of its startup
 routine. Since  card 1 is always opened first, a preopenstack handler there
 will always fire and you can do your setup there from that card without
 worrying about timing.

 On December 27, 2014 10:12:19 AM CST, Michael Doub miked...@gmail.com
 wrote:

 Jacqueline and Mike, thanks for you help with this.

 Just to clarify,  I am trying to solve the problem in the environment
 where livecode is not running and the user double clicks on the
 MasterLibrary stack.   This is not a standalone program but a stack
 that
 is being started from the desktop.  I am testing on a Mac, but I need
 to
 test on a PC to see if the behavior is any different.

 Mike, I think you gave me a great clue.   The current logic in the
 MasterLibrary is one where the preopenstack handler puts up a splash
 screen and sends off a wakeup message to come back in 5 seconds.  I was

 quite surprised to see how long it actually took the IDE to get
 initialized.  This is way too long to wait if livecode is already up
 and
 running.

 I added some debug code to display the allowinterupt state and found
 that at the time my preopenstack handler messages gets called
 allowinterupts is false, but in my wakeup hander the allowinterupts is
 true.  This leads me to believe that I can monitor the allowinterupts
 at
 a faster frequency and do the actual wake up processing when I see it
 go
 true.

 Regards,
  Mike


 On 12/26/14 4:38 PM, Mike Bonner wrote:

 It looks like the IDE load order is this:
 System params are checked
 libraries loaded
 globals set
 preferences set
 icons loaded
 patterns loaded
 script editor loaded
 user icon libraries loaded
 error management loaded
 tools loaded
 menu bar loaded
 app overview loaded
 message box loaded
 debugger loaded
 quicktime loaded
 plugins loaded
 then revInternail_InitializeFinalSteps..
 after that, there are still a couple things such as checking the

 license

 being used (community etc) and setting some os specific parameters.

 The

 very last thing (it 

Re: How to tell when IDE is done loading

2014-12-28 Thread Richard Gaskin

Mike Bonner wrote:


Unless there is a wait with messages somewhere along the line
in that big startup handler I mentioned in the previous post,
the send that you do should be dumped at the end of the queue
and not fire until things are done.


I had thought so myself, but apparently it varies by OS - see the 
discussion in this request submitted by a RunRev team member for 
messages that fire on idle:

http://quality.runrev.com/show_bug.cgi?id=13585

Initially I chimed in there thinking the request was in error, that 
timers would always fire only after other handlers were completed. Peter 
Brett's notes in Comment 7 there describes the details:


Currently, the ordering is platform-dependent.  On some platforms,
overdue engine messages are processed before overdue system events.
On other platforms, engine events are processed before engine
messages if the oldest engine event is older than the most overdue
engine message.

That comment contains other info about why idle messages aren't a good 
alternative, well worth reading for those with an interest in such 
details.


--
 Richard Gaskin
 Fourth World Systems
 LiveCode training and consulting: http://www.fourthworld.com
 Webzine for LiveCode developers: http://www.LiveCodeJournal.com
 Follow me on Twitter: http://twitter.com/FourthWorldSys

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to tell when IDE is done loading

2014-12-28 Thread Michael Doub

Mike,

Your plugin suggestion was a good one.   When I removed them all I am 
now getting the expected behavior.
I now need to add them back in one at a time to find the one that is not 
setting allowinterrupts to true.


It does seem that allowinterupts is the correct vehicle to tell when the 
livecode part of the IDE has been fully initialized, but because of user 
written plugins it is not totally reliable.   Any other thoughts?   I am 
going to submit an enhancement request and see if something more 
reliable could be made available longer term.


Regards,
   Mike


On 12/28/14 11:02 AM, Mike Bonner wrote:

Things are working correctly for me. 7.0.0, (since 7.0.1 still won't
install) When starting up the stack and IDE by opening the stack,false is
first.  After the IDE is fully open, allowinterupts seems to always be true
for me.

Not managing to duplicate the problem so far. I did adjust things so that
the ctr variable gets set to the message box too during the send loop, and
its always 1, which seems to indicate a simple send in time should be
sufficient. (send whatever to me in 0). Unless there is a wait with
messages somewhere along the line in that big startup handler I mentioned
in the previous post, the send that you do should be dumped at the end of
the queue and not fire until things are done.  (this is how people have
been getting around library loading problems.  Either a send to place the
call at the end of the queue, or using openstack or opencard instead since
they happen slightly later.)
IF you're getting allowinterups = false AFTER the IDE is fully open, (or
seems to be) something funky is going on.  Do you have any plugins?  Can
you take them out of the equation for now, then add them back in one at a
time?  That handler I mentioned also does copious logging, you might be
able to track down where the log is, and look at it.

On Sun, Dec 28, 2014 at 8:29 AM, Michael Doub miked...@gmail.com wrote:


Jacqueline, I do think that there is a timeing issue that you have to be
aware of if you a calling revloadedstacks.
But something strange _IS_ going on.

Please create a stack and enter the script below into the stack script and
save the stack and quit livecode.   Doubleclick on the stack icon.

You should see...

false
preOpenStack
true
Startup Complete

This is the expected behavior.   Note that the preOpenStack handler is
called before the IDE home stack has finished initialization. This can
clearly be seen if you watch the message box closely.

Now close the stack and remove it from memory and then open the stack.   I
do not get the expected behavior.  It seems that allowinterupts is set to
false.   I get false on a clean start of livecode and checking
allowinterrupts from the message box too.

Can you confirm what I am seeing or explain what is going on, or have I
found a bug?  it appears to me that somewhere in the IDE, allowinterupts is
being set to false again after the main startup code in the home stack
resulting in the default state to be incorrect.

Regards,
Mike


local ctr

on preopenstack
put the allowinterrupts  cr
send Mark_IDE_done to me in 2 ticks
put preOpenStack  cr
end preopenstack

on Mark_IDE_done
add 1 to ctr
put  allowinterrupts  cr after msg
if allowinterrupts = false then
   if ctr  25 then
  send Mark_IDE_done to me in 2 ticks
   end if
else
   put Startup Complete  cr after msg
end if
end Mark_IDE_done



On 12/27/14 11:29 AM, J. Landman Gay wrote:


I'm confused. LiveCode knows how to open a stack as part of its startup
routine. Since  card 1 is always opened first, a preopenstack handler there
will always fire and you can do your setup there from that card without
worrying about timing.

On December 27, 2014 10:12:19 AM CST, Michael Doub miked...@gmail.com
wrote:


Jacqueline and Mike, thanks for you help with this.

Just to clarify,  I am trying to solve the problem in the environment
where livecode is not running and the user double clicks on the
MasterLibrary stack.   This is not a standalone program but a stack
that
is being started from the desktop.  I am testing on a Mac, but I need
to
test on a PC to see if the behavior is any different.

Mike, I think you gave me a great clue.   The current logic in the
MasterLibrary is one where the preopenstack handler puts up a splash
screen and sends off a wakeup message to come back in 5 seconds.  I was

quite surprised to see how long it actually took the IDE to get
initialized.  This is way too long to wait if livecode is already up
and
running.

I added some debug code to display the allowinterupt state and found
that at the time my preopenstack handler messages gets called
allowinterupts is false, but in my wakeup hander the allowinterupts is
true.  This leads me to believe that I can monitor the allowinterupts
at
a faster frequency and do the actual wake up processing when I see it
go
true.

Regards,
  Mike


On 12/26/14 4:38 PM, Mike Bonner wrote:


Re: How to tell when IDE is done loading

2014-12-28 Thread J. Landman Gay
I'm still not sure you need to mess with any of this.  What does your script 
need to do when the IDE finishes loading? 

On December 28, 2014 10:29:36 AM CST, Michael Doub miked...@gmail.com wrote:

It does seem that allowinterupts is the correct vehicle to tell when
the 
livecode part of the IDE has been fully initialized, but because of
user 
written plugins it is not totally reliable.   Any other thoughts?   I
am 
going to submit an enhancement request and see if something more 
reliable could be made available longer term.

-- 
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to tell when IDE is done loading

2014-12-28 Thread Michael Doub
This should help you see the problem I was trying to solve: Consider the 
following code:


local ctr

on openstack
put OpenStack  cr
   put the allowinterrupts  cr after msg
   try
  put revloadedstacks()  cr after msg
   catch err
  put revloadedstack not found   cr  err  cr after msg
   end try
   send Mark_IDE_done to me in 2 ticks
end openstack

on Mark_IDE_done
   add 1 to ctr
   put  allowinterrupts  cr after msg
   if allowinterrupts = false then
  if ctr  25 then
 send Mark_IDE_done to me in 2 ticks
  end if
   else
  put Startup Complete  cr after msg
   put revloadedstacks()  cr after msg
   end if
end Mark_IDE_done

Assume this is code is in a stack on the desktop and livecode is not 
running.  When the user open this stack from the desktop you will see 
the following in the message box:


OpenStack
false
revloadedstack not found
219,7,11,revloadedstacks
118,7,11
465,7,11
true
Startup Complete
startupTest

Note that the OpenStack message is received before the initialization of 
the IDE has completed so when the revloadedstack function was called, it 
was not found.   if you look at the IDE home stack, you will see the 
interrupts are blocked until all of the IDE initialization is completed.


I think that some of your assumptions regarding the loading of stacks 
may be incorrect.  This is clearly showing that a users stack does in 
fact start execution before livecode initialization is completed.


The other interesting thing to note is that I found a plugin that looks 
like it was setting allowinterrupts to false and never setting it back 
to true.  I put that counter in the Mark_IDE_done handler so it would 
not fire forever as I was debugging.  Anyway, I sent off an email to the 
developer of the plugin to start the discussion with him off line.


I hope this clears things up for you.

Regards,
   Mike


On 12/28/14 12:53 PM, J. Landman Gay wrote:

I'm still not sure you need to mess with any of this.  What does your script 
need to do when the IDE finishes loading?

On December 28, 2014 10:29:36 AM CST, Michael Doub miked...@gmail.com wrote:

It does seem that allowinterupts is the correct vehicle to tell when
the
livecode part of the IDE has been fully initialized, but because of
user
written plugins it is not totally reliable.   Any other thoughts?   I
am
going to submit an enhancement request and see if something more
reliable could be made available longer term.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to tell when IDE is done loading

2014-12-28 Thread J. Landman Gay

On 12/28/2014 12:44 PM, Michael Doub wrote:


Note that the OpenStack message is received before the initialization of
the IDE has completed so when the revloadedstack function was called, it
was not found.   if you look at the IDE home stack, you will see the
interrupts are blocked until all of the IDE initialization is completed.

I think that some of your assumptions regarding the loading of stacks
may be incorrect.  This is clearly showing that a users stack does in
fact start execution before livecode initialization is completed.

The other interesting thing to note is that I found a plugin that looks
like it was setting allowinterrupts to false and never setting it back
to true.  I put that counter in the Mark_IDE_done handler so it would
not fire forever as I was debugging.  Anyway, I sent off an email to the
developer of the plugin to start the discussion with him off line.

I hope this clears things up for you.


Not entirely. It shows how you tested the message order, but not what 
you want your script to do or what your final goal is. Or are you just 
trying to find out which LC stacks are open?


It does look like I was wrong about the sequence specifics. But however 
it works, I think many of us use a delayed call to do something after 
the IDE is done launching. Whatever your final goal is, it seems it 
could be more easily done with this:


on openStack
 send myHandler to me in 1 second
end openStack

on myHandler
  -- do actions here
  -- if the goal is to see which stacks are open, query revloadedstacks 
here

end myHandler

By the time myHandler triggers, the IDE is loaded. If you think it may 
take longer on slow machines, use 2 seconds. Put the handlers on the 
first card, so that openstack won't trigger more than once.


I'll admit this is a sort of fuzzy workaround, so your request for a new 
engine message is probably useful. But until we get that, the above 
seems to work.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to tell when IDE is done loading

2014-12-28 Thread Mike Bonner
No suggestions really, because i'm not sure whats going on (he says, as he
gets ready to make suggestions anyway).
It seems that since all the plugins are a part of the sequence in that
handler I mentioned, and that plugins are loaded before the allowinterupts
is set, it seems that you'd end up with false at the start, and false at
the end, due to the plugins causing a problem. I'll look at the code again
(tomorrow, today is on overload for me) and see if I can figure out where
that log is kept, (others probably know off the top of their heads) perhaps
there is a logged clue in there somewhere.

Richard, yep, that does throw a kink into my understanding.  Off to read up
on things.

As far as whether it is necessary to go to this trouble to discern the
state of the IDE, I gotta ask (as J has) does a simple send in time work?
If you display the counter as part of your messages, i'm pretty sure its
always 1, meaning the 2 ticks delay you use is plenty. And I suspect that
sending in 0 would work also, (unless the idle thing mentioned by Richard
is getting in the way).  In addition, would it work to put it into
openstack or opencard? Since they occur after the pre in the sequence of
things.

I think if it were me, I'd still pursue the plugins line of query also,
just to figure out why the allowinterrupts is misbehaving, but would look
for a simpler way to fix the initial issue.

On Sun, Dec 28, 2014 at 12:20 PM, J. Landman Gay jac...@hyperactivesw.com
wrote:

 On 12/28/2014 12:44 PM, Michael Doub wrote:


 Note that the OpenStack message is received before the initialization of
 the IDE has completed so when the revloadedstack function was called, it
 was not found.   if you look at the IDE home stack, you will see the
 interrupts are blocked until all of the IDE initialization is completed.

 I think that some of your assumptions regarding the loading of stacks
 may be incorrect.  This is clearly showing that a users stack does in
 fact start execution before livecode initialization is completed.

 The other interesting thing to note is that I found a plugin that looks
 like it was setting allowinterrupts to false and never setting it back
 to true.  I put that counter in the Mark_IDE_done handler so it would
 not fire forever as I was debugging.  Anyway, I sent off an email to the
 developer of the plugin to start the discussion with him off line.

 I hope this clears things up for you.


 Not entirely. It shows how you tested the message order, but not what you
 want your script to do or what your final goal is. Or are you just trying
 to find out which LC stacks are open?

 It does look like I was wrong about the sequence specifics. But however it
 works, I think many of us use a delayed call to do something after the IDE
 is done launching. Whatever your final goal is, it seems it could be more
 easily done with this:

 on openStack
  send myHandler to me in 1 second
 end openStack

 on myHandler
   -- do actions here
   -- if the goal is to see which stacks are open, query revloadedstacks
 here
 end myHandler

 By the time myHandler triggers, the IDE is loaded. If you think it may
 take longer on slow machines, use 2 seconds. Put the handlers on the first
 card, so that openstack won't trigger more than once.

 I'll admit this is a sort of fuzzy workaround, so your request for a new
 engine message is probably useful. But until we get that, the above seems
 to work.

 --
 Jacqueline Landman Gay | jac...@hyperactivesw.com
 HyperActive Software   | http://www.hyperactivesw.com

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to tell when IDE is done loading

2014-12-28 Thread Michael Doub
Jacqueline gave me a really slick solution to my problem off list. He is 
what I am going to use in the next release of the MasterLibrary:


on preopenstack
  send Mark_IDE_done to me in 2 ticks
  go to cd Splash
end preopenstack

on Mark_IDE_done
   try
  get revloadedstacks()
   catch err
  send Mark_IDE_done to me in 2 ticks
  exit to top
   end try
   go to cd LibMgr
end Mark_IDE_done

This is so simple, I really don't care about delaying for the whole IDE 
to be finished.   I only need a single function to be available.  This 
works like a charm.


Regards,
   Mike

On 12/28/14 4:24 PM, Mike Bonner wrote:

No suggestions really, because i'm not sure whats going on (he says, as he
gets ready to make suggestions anyway).
It seems that since all the plugins are a part of the sequence in that
handler I mentioned, and that plugins are loaded before the allowinterupts
is set, it seems that you'd end up with false at the start, and false at
the end, due to the plugins causing a problem. I'll look at the code again
(tomorrow, today is on overload for me) and see if I can figure out where
that log is kept, (others probably know off the top of their heads) perhaps
there is a logged clue in there somewhere.

Richard, yep, that does throw a kink into my understanding.  Off to read up
on things.

As far as whether it is necessary to go to this trouble to discern the
state of the IDE, I gotta ask (as J has) does a simple send in time work?
If you display the counter as part of your messages, i'm pretty sure its
always 1, meaning the 2 ticks delay you use is plenty. And I suspect that
sending in 0 would work also, (unless the idle thing mentioned by Richard
is getting in the way).  In addition, would it work to put it into
openstack or opencard? Since they occur after the pre in the sequence of
things.

I think if it were me, I'd still pursue the plugins line of query also,
just to figure out why the allowinterrupts is misbehaving, but would look
for a simpler way to fix the initial issue.

On Sun, Dec 28, 2014 at 12:20 PM, J. Landman Gay jac...@hyperactivesw.com
wrote:


On 12/28/2014 12:44 PM, Michael Doub wrote:


Note that the OpenStack message is received before the initialization of
the IDE has completed so when the revloadedstack function was called, it
was not found.   if you look at the IDE home stack, you will see the
interrupts are blocked until all of the IDE initialization is completed.

I think that some of your assumptions regarding the loading of stacks
may be incorrect.  This is clearly showing that a users stack does in
fact start execution before livecode initialization is completed.

The other interesting thing to note is that I found a plugin that looks
like it was setting allowinterrupts to false and never setting it back
to true.  I put that counter in the Mark_IDE_done handler so it would
not fire forever as I was debugging.  Anyway, I sent off an email to the
developer of the plugin to start the discussion with him off line.

I hope this clears things up for you.


Not entirely. It shows how you tested the message order, but not what you
want your script to do or what your final goal is. Or are you just trying
to find out which LC stacks are open?

It does look like I was wrong about the sequence specifics. But however it
works, I think many of us use a delayed call to do something after the IDE
is done launching. Whatever your final goal is, it seems it could be more
easily done with this:

on openStack
  send myHandler to me in 1 second
end openStack

on myHandler
   -- do actions here
   -- if the goal is to see which stacks are open, query revloadedstacks
here
end myHandler

By the time myHandler triggers, the IDE is loaded. If you think it may
take longer on slow machines, use 2 seconds. Put the handlers on the first
card, so that openstack won't trigger more than once.

I'll admit this is a sort of fuzzy workaround, so your request for a new
engine message is probably useful. But until we get that, the above seems
to work.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to tell when IDE is done loading

2014-12-27 Thread Michael Doub

Jacqueline and Mike, thanks for you help with this.

Just to clarify,  I am trying to solve the problem in the environment 
where livecode is not running and the user double clicks on the 
MasterLibrary stack.   This is not a standalone program but a stack that 
is being started from the desktop.  I am testing on a Mac, but I need to 
test on a PC to see if the behavior is any different.


Mike, I think you gave me a great clue.   The current logic in the 
MasterLibrary is one where the preopenstack handler puts up a splash 
screen and sends off a wakeup message to come back in 5 seconds.  I was 
quite surprised to see how long it actually took the IDE to get 
initialized.  This is way too long to wait if livecode is already up and 
running.


I added some debug code to display the allowinterupt state and found 
that at the time my preopenstack handler messages gets called 
allowinterupts is false, but in my wakeup hander the allowinterupts is 
true.  This leads me to believe that I can monitor the allowinterupts at 
a faster frequency and do the actual wake up processing when I see it go 
true.


Regards,
Mike


On 12/26/14 4:38 PM, Mike Bonner wrote:

It looks like the IDE load order is this:
System params are checked
libraries loaded
globals set
preferences set
icons loaded
patterns loaded
script editor loaded
user icon libraries loaded
error management loaded
tools loaded
menu bar loaded
app overview loaded
message box loaded
debugger loaded
quicktime loaded
plugins loaded
then revInternail_InitializeFinalSteps..
after that, there are still a couple things such as checking the license
being used (community etc) and setting some os specific parameters.  The
very last thing (it seems) is the line set the allowinterrupts to true

You can see this info in the script of stack home.rev, handler
revInternal_openStack.  Wonder if there is something in that script you can
check to determine if the IDE is far enough along to do the things you
need.


On Fri, Dec 26, 2014 at 1:31 PM, J. Landman Gay jac...@hyperactivesw.com
wrote:


On 12/24/2014 11:57 AM, Michael Doub wrote:


I have tried that but I need to process the resumeStack message which
seems to get called as part of the startup process.


Resumestack shouldn't be sent normally when a stack opens. There's a
difference between starting up a standalone and starting the IDE though; it
may be that some of the IDE stacks need to deal with resumestack. But your
own stack shouldn't need to.

  I guess I have to

manually set a global flag and have the timed handler unblock the
flag.   What is the very first handler that an application can process?
Startup?


Again, it depends. In a standalone the first message is startup. The stack
isn't fully loaded at that point so you can't manipulate stack or card
objects yet but you can set global properties there.

But in the IDE, LiveCode itself catches the startup message and your stack
will never receive it. The first message your stack will get is
preOpenStack.


  Is there an ordered list of messages that are fired for startup and

opening a stack?  Opening a card would be useful too.   I can't say that
I have ever seen this anywhere in the documentation.


It follows the normal message path in reverse, starting with the stack
messages followed by background group messages and then card messages. If
there are card groups on the first card, they get sent last.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to tell when IDE is done loading

2014-12-27 Thread J. Landman Gay
I'm confused. LiveCode knows how to open a stack as part of its startup 
routine. Since  card 1 is always opened first, a preopenstack handler there 
will always fire and you can do your setup there from that card without 
worrying about timing. 

On December 27, 2014 10:12:19 AM CST, Michael Doub miked...@gmail.com wrote:
Jacqueline and Mike, thanks for you help with this.

Just to clarify,  I am trying to solve the problem in the environment 
where livecode is not running and the user double clicks on the 
MasterLibrary stack.   This is not a standalone program but a stack
that 
is being started from the desktop.  I am testing on a Mac, but I need
to 
test on a PC to see if the behavior is any different.

Mike, I think you gave me a great clue.   The current logic in the 
MasterLibrary is one where the preopenstack handler puts up a splash 
screen and sends off a wakeup message to come back in 5 seconds.  I was

quite surprised to see how long it actually took the IDE to get 
initialized.  This is way too long to wait if livecode is already up
and 
running.

I added some debug code to display the allowinterupt state and found 
that at the time my preopenstack handler messages gets called 
allowinterupts is false, but in my wakeup hander the allowinterupts is 
true.  This leads me to believe that I can monitor the allowinterupts
at 
a faster frequency and do the actual wake up processing when I see it
go 
true.

Regards,
 Mike


On 12/26/14 4:38 PM, Mike Bonner wrote:
 It looks like the IDE load order is this:
 System params are checked
 libraries loaded
 globals set
 preferences set
 icons loaded
 patterns loaded
 script editor loaded
 user icon libraries loaded
 error management loaded
 tools loaded
 menu bar loaded
 app overview loaded
 message box loaded
 debugger loaded
 quicktime loaded
 plugins loaded
 then revInternail_InitializeFinalSteps..
 after that, there are still a couple things such as checking the
license
 being used (community etc) and setting some os specific parameters. 
The
 very last thing (it seems) is the line set the allowinterrupts to
true

 You can see this info in the script of stack home.rev, handler
 revInternal_openStack.  Wonder if there is something in that script
you can
 check to determine if the IDE is far enough along to do the things
you
 need.


 On Fri, Dec 26, 2014 at 1:31 PM, J. Landman Gay
jac...@hyperactivesw.com
 wrote:

 On 12/24/2014 11:57 AM, Michael Doub wrote:

 I have tried that but I need to process the resumeStack message
which
 seems to get called as part of the startup process.

 Resumestack shouldn't be sent normally when a stack opens. There's a
 difference between starting up a standalone and starting the IDE
though; it
 may be that some of the IDE stacks need to deal with resumestack.
But your
 own stack shouldn't need to.

   I guess I have to
 manually set a global flag and have the timed handler unblock the
 flag.   What is the very first handler that an application can
process?
 Startup?

 Again, it depends. In a standalone the first message is startup. The
stack
 isn't fully loaded at that point so you can't manipulate stack or
card
 objects yet but you can set global properties there.

 But in the IDE, LiveCode itself catches the startup message and your
stack
 will never receive it. The first message your stack will get is
 preOpenStack.


   Is there an ordered list of messages that are fired for startup
and
 opening a stack?  Opening a card would be useful too.   I can't say
that
 I have ever seen this anywhere in the documentation.

 It follows the normal message path in reverse, starting with the
stack
 messages followed by background group messages and then card
messages. If
 there are card groups on the first card, they get sent last.

 --
 Jacqueline Landman Gay | jac...@hyperactivesw.com
 HyperActive Software   | http://www.hyperactivesw.com

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

-- 
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 

Re: How to tell when IDE is done loading

2014-12-26 Thread J. Landman Gay

On 12/24/2014 11:57 AM, Michael Doub wrote:

I have tried that but I need to process the resumeStack message which
seems to get called as part of the startup process.


Resumestack shouldn't be sent normally when a stack opens. There's a 
difference between starting up a standalone and starting the IDE though; 
it may be that some of the IDE stacks need to deal with resumestack. But 
your own stack shouldn't need to.



I guess I have to
manually set a global flag and have the timed handler unblock the
flag.   What is the very first handler that an application can process?
Startup?


Again, it depends. In a standalone the first message is startup. The 
stack isn't fully loaded at that point so you can't manipulate stack or 
card objects yet but you can set global properties there.


But in the IDE, LiveCode itself catches the startup message and your 
stack will never receive it. The first message your stack will get is 
preOpenStack.




Is there an ordered list of messages that are fired for startup and
opening a stack?  Opening a card would be useful too.   I can't say that
I have ever seen this anywhere in the documentation.


It follows the normal message path in reverse, starting with the stack 
messages followed by background group messages and then card messages. 
If there are card groups on the first card, they get sent last.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to tell when IDE is done loading

2014-12-26 Thread Mike Bonner
It looks like the IDE load order is this:
System params are checked
libraries loaded
globals set
preferences set
icons loaded
patterns loaded
script editor loaded
user icon libraries loaded
error management loaded
tools loaded
menu bar loaded
app overview loaded
message box loaded
debugger loaded
quicktime loaded
plugins loaded
then revInternail_InitializeFinalSteps..
after that, there are still a couple things such as checking the license
being used (community etc) and setting some os specific parameters.  The
very last thing (it seems) is the line set the allowinterrupts to true

You can see this info in the script of stack home.rev, handler
revInternal_openStack.  Wonder if there is something in that script you can
check to determine if the IDE is far enough along to do the things you
need.


On Fri, Dec 26, 2014 at 1:31 PM, J. Landman Gay jac...@hyperactivesw.com
wrote:

 On 12/24/2014 11:57 AM, Michael Doub wrote:

 I have tried that but I need to process the resumeStack message which
 seems to get called as part of the startup process.


 Resumestack shouldn't be sent normally when a stack opens. There's a
 difference between starting up a standalone and starting the IDE though; it
 may be that some of the IDE stacks need to deal with resumestack. But your
 own stack shouldn't need to.

  I guess I have to
 manually set a global flag and have the timed handler unblock the
 flag.   What is the very first handler that an application can process?
 Startup?


 Again, it depends. In a standalone the first message is startup. The stack
 isn't fully loaded at that point so you can't manipulate stack or card
 objects yet but you can set global properties there.

 But in the IDE, LiveCode itself catches the startup message and your stack
 will never receive it. The first message your stack will get is
 preOpenStack.


  Is there an ordered list of messages that are fired for startup and
 opening a stack?  Opening a card would be useful too.   I can't say that
 I have ever seen this anywhere in the documentation.


 It follows the normal message path in reverse, starting with the stack
 messages followed by background group messages and then card messages. If
 there are card groups on the first card, they get sent last.

 --
 Jacqueline Landman Gay | jac...@hyperactivesw.com
 HyperActive Software   | http://www.hyperactivesw.com

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to tell when IDE is done loading

2014-12-24 Thread Michael Doub
I have tried that but I need to process the resumeStack message which 
seems to get called as part of the startup process.   I guess I have to 
manually set a global flag and have the timed handler unblock the 
flag.   What is the very first handler that an application can process?  
Startup?


Is there an ordered list of messages that are fired for startup and 
opening a stack?  Opening a card would be useful too.   I can't say that 
I have ever seen this anywhere in the documentation.   Is this derivable 
programmatically?


Regards,
Mike


On 12/23/14 11:09 PM, J. Landman Gay wrote:

On 12/23/2014 2:44 PM, Michael Doub wrote:

How can you tell when the IDE is done loading?   I am trying to figure
out how to have the initialization of my app happen _after_ all of the
IDE stacks have loaded.  When my stack is double clicked from the
desktop, my initialization code calls revloadedStacks() before the IDE
has loaded it and I am getting an execution error.


I usually just put in a send myHandler to me in 1 second command in 
an openStack handler on the first card. Then myHandler does whatever 
needs doing. One second seems like enough time usually.





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


How to tell when IDE is done loading

2014-12-23 Thread Michael Doub
How can you tell when the IDE is done loading?   I am trying to figure 
out how to have the initialization of my app happen _after_ all of the 
IDE stacks have loaded.  When my stack is double clicked from the 
desktop, my initialization code calls revloadedStacks() before the IDE 
has loaded it and I am getting an execution error.


Thanks
  Mike




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to tell when IDE is done loading

2014-12-23 Thread J. Landman Gay

On 12/23/2014 2:44 PM, Michael Doub wrote:

How can you tell when the IDE is done loading?   I am trying to figure
out how to have the initialization of my app happen _after_ all of the
IDE stacks have loaded.  When my stack is double clicked from the
desktop, my initialization code calls revloadedStacks() before the IDE
has loaded it and I am getting an execution error.


I usually just put in a send myHandler to me in 1 second command in an 
openStack handler on the first card. Then myHandler does whatever 
needs doing. One second seems like enough time usually.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode