Page 1 of 1

list of the instructions sent to LiveCode

Posted: Wed Apr 24, 2013 9:40 am
by danielrr
Sorry if this question is too obvious and it is answered in page one of the manual (I've trough most of the manual and didn't find the answer there, thoug it is likely my fault)

¿How can I see a list of the instructions that are currently being sent to and from LiveCode (hopefully without the idles & things like that)?

For instance: When I click in a field How do I know what objects intercepted the mouseup, mousewithin etc messages before arriving at the mouseup message in the field's script?

thanks in advance

Re: list of the instructions sent to LiveCode

Posted: Wed Apr 24, 2013 12:55 pm
by bn
Hi Daniel,

in the manual look at section
5.2 Events
5.2.1 What Causes Messages to be Sent
5.2.2 Responding to Events
5.3 TheMessagePath

Richard Gaskin also has an explanation on his website
http://fourthworld.com/embassy/articles ... _path.html

What you are asking is at the very heart of LiveCode and it is important to understand the logic of the message path.
When I click in a field How do I know what objects intercepted the mouseup, mousewithin etc messages before arriving at the mouseup message in the field's script?
In this case the field gets the mouseUp etc first. If the field has a handler for the message, e.g. on mouseUp / end mouseUp then the field handles the message and that is it. The message ends as soon as it it handled and not passed on, or if no handler trapse the message the message will go all the way of the message path and will vanish thereafter. The only object that can get a "mouseUp" before the field gets it would be a frontScript.

But it is better to read up on this and ask specific questions then.

Kind regards
Bernd

Re: list of the instructions sent to LiveCode

Posted: Wed Apr 24, 2013 1:31 pm
by danielrr
bn wrote:Hi Daniel,

in the manual look at section
5.2 Events
5.2.1 What Causes Messages to be Sent
5.2.2 Responding to Events
5.3 TheMessagePath

Richard Gaskin also has an explanation on his website
http://fourthworld.com/embassy/articles ... _path.html

What you are asking is at the very heart of LiveCode and it is important to understand the logic of the message path.
When I click in a field How do I know what objects intercepted the mouseup, mousewithin etc messages before arriving at the mouseup message in the field's script?
In this case the field gets the mouseUp etc first. If the field has a handler for the message, e.g. on mouseUp / end mouseUp then the field handles the message and that is it. The message ends as soon as it it handled and not passed on, or if no handler trapse the message the message will go all the way of the message path and will vanish thereafter. The only object that can get a "mouseUp" before the field gets it would be a frontScript.

But it is better to read up on this and ask specific questions then.

Kind regards
Bernd

HI Bernd,

Thanks for the answer and for the link to Richard Gaskin's useful site. But this is not exactly what I was asking. I understand (at least I think I understand) how the message path works, but I would like to be able to know what are the messages that are actually being sent to liveCode (or to the system, if you wish)

Say you clicked over a field or a button. ¿how can you be sure that this field's or button's script trapped the mouseup message before, say, a transparent field or button placed in the same place, above them, unbeknownst to you? Sure you can have a look around to see if there are "things" that may trap your messages, but I would like to know if LiveCode has something similar to HyperCard's "Events Manager" a very clever device that featured a "Ignore Unused Messages" and "Hide Idle" options, if I recall well.

I am working with a rather complex stack that (crucially) depends heavily upon messages of the mouseenter, mouseleaves and similar kind, and sometimes a part of the program's behaves in a unexpected way. In such occasions, I'd like to be able to check if this is due to some object trapping a message not intended for it, before going into deeper explorations.

best,

Daniel

Re: list of the instructions sent to LiveCode

Posted: Wed Apr 24, 2013 2:11 pm
by Dixie
Daniel...

In the IDE choose 'message Watcher' from the 'Development' menu...

Dixie

Re: list of the instructions sent to LiveCode

Posted: Wed Apr 24, 2013 2:13 pm
by bn
Hi Daniel,

OK, I understand better now.

First, you are the one that designs a stack and should know what objects are where :)

If you don't have any frontScript then the object under the mouse will get the message first. E.g. mouseEnter, mouseLeave.

If you are unsure about transparent objects hiding your target you could use the "mouseControl" to find out if your target is the one that gets the messages.

a simple stack with a button and a field

Code: Select all

local sTrackMouse = false

on mouseUp
   if sTrackMouse then 
      put false into sTrackMouse
      set the label of me to "start reporting"
   else
      put true into sTrackMouse
      send getMouseControl to me in 50 milliseconds
      set the label of me to "stop reporting"
   end if
end mouseUp

on getMouseControl
   if sTrackMouse then
      put the mouseControl into tControl
      if tControl <> "" then  put the the long name of the mouseControl into field 1
      send getMouseControl to me in 50 milliseconds
   end if
end getMouseControl
This also reports the mouseControl of other stacks than its own.
As for an "Events Manager" I don't know of any for LiveCode. But then LiveCode dispatches some messages only if there is a handler for it. E.g. mouseWithin is only dispatched if there is a handler for it since mouseWithin is using quite some resources to be useful. (polling the mouse at short intervals)

If you have some controls that overlap each other and you want make shure your target gets the message set its layer to front. Or in the inspector "size and position" all the way to the front.

Maybe this does not exactly answer your question but feel free to ask if I missed something.

Kind regards
Bernd

Re: list of the instructions sent to LiveCode

Posted: Wed Apr 24, 2013 2:20 pm
by danielrr
Dixie wrote:Daniel...

In the IDE choose 'message Watcher' from the 'Development' menu...

Dixie

Thanks so much. It was there all the time... Thanks