how come that some scripts work even when the project is not running?

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
Francesco77
Posts: 40
Joined: Mon Nov 16, 2020 8:16 pm

how come that some scripts work even when the project is not running?

Post by Francesco77 » Wed Dec 09, 2020 10:22 am

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10319
Joined: Wed May 06, 2009 2:28 pm

Re: how come that some scripts work even when the project is not running?

Post by dunbarx » Wed Dec 09, 2020 3:15 pm

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

SparkOut
Posts: 2946
Joined: Sun Sep 23, 2007 4:58 pm

Re: how come that some scripts work even when the project is not running?

Post by SparkOut » Wed Dec 09, 2020 3:26 pm

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10048
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: how come that some scripts work even when the project is not running?

Post by FourthWorld » Wed Dec 09, 2020 4:35 pm

"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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Francesco77
Posts: 40
Joined: Mon Nov 16, 2020 8:16 pm

Re: how come that some scripts work even when the project is not running?

Post by Francesco77 » Wed Dec 09, 2020 5:22 pm

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?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10319
Joined: Wed May 06, 2009 2:28 pm

Re: how come that some scripts work even when the project is not running?

Post by dunbarx » 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?

Francesco, "mouseLeave" and "mouseDoubleDown", as well as "focus out" and a few IDE messages are sent with the pointer tool.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7391
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: how come that some scripts work even when the project is not running?

Post by jacque » Wed Dec 09, 2020 6:20 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Francesco77
Posts: 40
Joined: Mon Nov 16, 2020 8:16 pm

Re: how come that some scripts work even when the project is not running?

Post by Francesco77 » Wed Dec 09, 2020 7:41 pm

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 :oops:

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 :wink:

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7391
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: how come that some scripts work even when the project is not running?

Post by jacque » Wed Dec 09, 2020 8:19 pm

We love new users and no question is too silly. Ask us anything and don't be shy.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply