Build-time v Run-time

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Build-time v Run-time

Graham Samuel-4
Another naive questions, but this hasn't happened to me before, or at least I haven't recognised it properly.

I'm looking at some code written by an associate. As normal (to me) it's a mainstack and a lot of substacks. I want to tinker with the code, so I open the mainstack in the LC IDE, and immediately the program starts to run, even though the Edit tool is active in the toolbar rather than the Browse tool - it starts up and does stuff, like the IDE does. I don't want that, I want the code to remain entirely passive until I tell it to run!

How does a stack get into 'instant run mode' like that, and what can I do to stop it? Is there some way of creeping up on it so that no handler is executed?

Actually I noticed that Thierry's Kickstarter monitoring program does the same thing, but I still don't understand it, even tho it only has a few lines of script. What apparently happens is that the preOpenCard handler is executed when the file is opened, but why?

Dumb again

Graham
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Build-time v Run-time

Klaus on-rev
Hi Graham,

Am 15.02.2013 um 17:56 schrieb Graham Samuel <[hidden email]>:

> Another naive questions, but this hasn't happened to me before, or at least I haven't recognised it properly.
>
> I'm looking at some code written by an associate. As normal (to me) it's a mainstack and a lot of substacks. I want to tinker with the code, so I open the mainstack in the LC IDE, and immediately the program starts to run, even though the Edit tool is active in the toolbar rather than the Browse tool - it starts up and does stuff, like the IDE does. I don't want that, I want the code to remain entirely passive until I tell it to run!
>
> How does a stack get into 'instant run mode' like that, and what can I do to stop it? Is there some way of creeping up on it so that no handler is executed?
>
> Actually I noticed that Thierry's Kickstarter monitoring program does the same thing, but I still don't understand it, even tho it only has a few lines of script. What apparently happens is that the preOpenCard handler is executed when the file is opened, but why?

when you open a stack, all "pre-/open-stack/card" handlers will be executed, no matter what the current "tool" is!
You can "lock messages" before opening a stack to prevent this:
...
lock messages
go stack "path/to/stack"
...

Or select "Suppress messages" in the "development" menu in Livecode before opening that stack.
Which does the same.

And don't forget to switch it back afterwards! ;-)

Hope that helps.

> Dumb again
>
> Graham

Best

Klaus

--
Klaus Major
http://www.major-k.de
[hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Build-time v Run-time

Graham Samuel-4
Thanks Klaus. I guess I didn't encounter this because I always begin my apps with a 'startUp' handler - these are not executed when a stack is loaded into the IDE, but they are when a standalone is loaded. One can test the logic by doing 'send "startUp" to...'. I do use preOpenCard handlers but usually in distant cards which are only opened under program control.

Funny I didn't realise this after all this time.

Thanks again.

Graham


On 15 Feb 2013, at 18:05, Klaus on-rev wrote:

> Hi Graham,
>
> Am 15.02.2013 um 17:56 schrieb Graham Samuel <[hidden email]>:
>
>> Another naive questions, but this hasn't happened to me before, or at least I haven't recognised it properly.
>>
>> I'm looking at some code written by an associate. As normal (to me) it's a mainstack and a lot of substacks. I want to tinker with the code, so I open the mainstack in the LC IDE, and immediately the program starts to run, even though the Edit tool is active in the toolbar rather than the Browse tool - it starts up and does stuff, like the IDE does. I don't want that, I want the code to remain entirely passive until I tell it to run!
>>
>> How does a stack get into 'instant run mode' like that, and what can I do to stop it? Is there some way of creeping up on it so that no handler is executed?
>>
>> Actually I noticed that Thierry's Kickstarter monitoring program does the same thing, but I still don't understand it, even tho it only has a few lines of script. What apparently happens is that the preOpenCard handler is executed when the file is opened, but why?
>
> when you open a stack, all "pre-/open-stack/card" handlers will be executed, no matter what the current "tool" is!
> You can "lock messages" before opening a stack to prevent this:
> ...
> lock messages
> go stack "path/to/stack"
> ...
>
> Or select "Suppress messages" in the "development" menu in Livecode before opening that stack.
> Which does the same.
>
> And don't forget to switch it back afterwards! ;-)
>
> Hope that helps.
>
>> Dumb again
>>
>> Graham
>
> Best
>
> Klaus
>
> --
> Klaus Major
> http://www.major-k.de
> [hidden email]
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Build-time v Run-time

Robert Brenstein
In reply to this post by Graham Samuel-4
On 15.02.2013 at 17:56 Uhr +0100 Graham Samuel apparently wrote:

>Another naive questions, but this hasn't happened to me before, or
>at least I haven't recognised it properly.
>
>I'm looking at some code written by an associate. As normal (to me)
>it's a mainstack and a lot of substacks. I want to tinker with the
>code, so I open the mainstack in the LC IDE, and immediately the
>program starts to run, even though the Edit tool is active in the
>toolbar rather than the Browse tool - it starts up and does stuff,
>like the IDE does. I don't want that, I want the code to remain
>entirely passive until I tell it to run!
>
>How does a stack get into 'instant run mode' like that, and what can
>I do to stop it? Is there some way of creeping up on it so that no
>handler is executed?
>

Apparently, your associate coded something in one of the openXxxx
handlers to start execution. Those handlers run regardless of the IDE
mode. To achieve what you want, the code should check the environment
(look it up in the dictionary) and do not execute if it is
"development". If you want to be able to execute after all, to
simulate standalone execution, you may add checking whether the alt
key is down, and if it is down, execute regardless of the environment.

Robert

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Build-time v Run-time

Robert Sneidar
Easy enough to just click the suppress messages button before opening the stack. You will probably want to keep messages suppressed in this situation if going to other stacks and cards is going to trigger actions that the openstack has not set up yet. You can make a handler called startApp or something similar that the preOpenStack handler traps, so you can call it at will when you need to do runtime testing.

Bob


On Feb 15, 2013, at 9:23 AM, Robert Brenstein wrote:

> On 15.02.2013 at 17:56 Uhr +0100 Graham Samuel apparently wrote:
>> Another naive questions, but this hasn't happened to me before, or at least I haven't recognised it properly.
>>
>> I'm looking at some code written by an associate. As normal (to me) it's a mainstack and a lot of substacks. I want to tinker with the code, so I open the mainstack in the LC IDE, and immediately the program starts to run, even though the Edit tool is active in the toolbar rather than the Browse tool - it starts up and does stuff, like the IDE does. I don't want that, I want the code to remain entirely passive until I tell it to run!
>>
>> How does a stack get into 'instant run mode' like that, and what can I do to stop it? Is there some way of creeping up on it so that no handler is executed?
>>
>
> Apparently, your associate coded something in one of the openXxxx handlers to start execution. Those handlers run regardless of the IDE mode. To achieve what you want, the code should check the environment (look it up in the dictionary) and do not execute if it is "development". If you want to be able to execute after all, to simulate standalone execution, you may add checking whether the alt key is down, and if it is down, execute regardless of the environment.
>
> Robert
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode