Page 1 of 1
how come that some scripts work even when the project is not running?
Posted: Wed Dec 09, 2020 10:22 am
by Francesco77
I have some images combined into a group.
The group has among others a mouseEnter-script that detects over which of the image objects the mouse cursor is located.
Surprisingly this script works even when the project is not running. It puts the names of the objects into a field which is very convenient although I do not really understand how that is possible when the project is not running.
Other scripts e.g. a mouseUp-script in the same group behave as expected. They work in running mode and do not work in editing mode.
What is happening here? I also wonder if it is possible to create such "always-working-scripts" intentionally because I can imagine some useful usages for such scripts when working on a project in editing mode.
Re: how come that some scripts work even when the project is not running?
Posted: Wed Dec 09, 2020 3:15 pm
by dunbarx
Hi.
I am not sure what you mean by "not running". I assume you are getting "mouseEnter" messages which are firing in other places.
Do you mean the stack (or card) is not open? Or that you are getting "mouseEnter" messages even when the cursor is not near the group?
How are you "detecting" that mouseEnter is firing?
Craig
Re: how come that some scripts work even when the project is not running?
Posted: Wed Dec 09, 2020 3:26 pm
by SparkOut
I'm wondering if it might be to do with an "unplaced group" that jacque has expounded upon sometimes. It probably isn't, but if I can find any references then I will post, because she can explain it so much better than me.
Re: how come that some scripts work even when the project is not running?
Posted: Wed Dec 09, 2020 4:35 pm
by FourthWorld
"Editing mode" is a misnomer. LiveCode is truly live code; the pointer tool is one of several tool modes available to your application as well as the IDE. It's useful for layout, but is not limited to the IDE, and many messages will continue to be sent regardless of the tool currently in use.
If you wish to suppress all messages while you're working on layout you can use the button provided for that in the toolbar.
Re: how come that some scripts work even when the project is not running?
Posted: Wed Dec 09, 2020 5:22 pm
by Francesco77
Hi FourthWorld,
thank you for your explanation. I thought that the code would only executed when the BrowseTool is activated because the BrowseTool's tooltip says so.
Now I understand better how LC works and I understand why the mouseEnter code is executed even when LC is in PointerTool mode.
Does a list with permanently executed commands exist or is the mouseEnter event the only one that works without the need of the BrowseTool?
Re: how come that some scripts work even when the project is not running?
Posted: Wed Dec 09, 2020 5:26 pm
by dunbarx
Richard, how on earth did you grok that "not running" meant that the pointer tool was in play?
Francesco, "mouseLeave" and "mouseDoubleDown", as well as "focus out" and a few IDE messages are sent with the pointer tool.
Craig
Re: how come that some scripts work even when the project is not running?
Posted: Wed Dec 09, 2020 6:20 pm
by jacque
dunbarx wrote: ↑Wed Dec 09, 2020 5:26 pm
Richard, how on earth did you grok that "not running" meant that the pointer tool was in play?
This clued me: "They work in running mode and do not work in editing mode."
I haven't checked in a long time, but I recall that all messages are sent in a standalone whether the browse tool or the editing tool is selected. In the IDE, LC intercepts most messages when editing.
Re: how come that some scripts work even when the project is not running?
Posted: Wed Dec 09, 2020 7:41 pm
by Francesco77
dunbarx wrote: ↑Wed Dec 09, 2020 5:26 pm
Richard, how on earth did you grok that "not running" meant that the pointer tool was in play?
...
Oh, I did not know that my question was THAT stupid
In the past I worked with tools like Director, Toolbook Flash and some others. There was always a run mode for testing the application and an edit mode for editing and coding. Sometimes even a compilation before the code could be executed.
Therefore I assumed that this was also the case with LiveCode. It seems to me that LC works completely different concerning the "run" and "edit" modes.
Thanks for your help and patience with a newbie who has strange questions

Re: how come that some scripts work even when the project is not running?
Posted: Wed Dec 09, 2020 8:19 pm
by jacque
We love new users and no question is too silly. Ask us anything and don't be shy.