breakpoint on parameter

Quentin Long cubist at
Wed May 24 18:30:31 EDT 2017

sez "J. Landman Gay" <jacque at>:
| On 5/23/17 10:36 AM, Matt Maier via use-livecode wrote:
| > I want to find out which parts of my code are making changes to a control's
| > parameter. Specifically, I've got an arrow that I want to be black, and it
| > is black when it's created, but then it turns gray. I can't find the script
| > that's turning it gray.
| > 
| > I don't know where to put a breakpoint in the script.
| > 
| > Can I put a breakpoint on that control's color parameter, so execution
| > stops whenever something modifies it and goes to the script that's doing
| > the modification?
| You can't break for a parameter per se, only at a specified line of 
| script. …
I just had an idea that might be helpful for Matt Maier…

If I'm reading the LC Dictionary aright, the property "executionContexts" should be very useful for nailing down which handler did what at whatever time; you just need to look at the executionContexts at just the right moment. So, use a "send [whatever] in [time]" loop, like so:

on ColorCheck
  if (the color of the specific control) = "gray" then
    answer the executionContexts
  end if
  if the optionKey is up then send "ColorCheck" to me in 50 milliseconds
end ColorCheck

Ordinarily, "send [whatever] in [time]" loops are frowned upon because they burn cycles gratuitously, thus slowing down the stack's operations. But in this case, slowing down the stack's operations should be acceptable, as it gives you a better chance of catching the offending command (i.e., the one that's doing the color-change) in the act.

Troubleshooting: If what's really happening is an change in the control's blend property, that could make the control *appear* to change color while said color is actually the same, in which case the "answer the executionContexts" line would never execute. If this happens, check for a change in the control's blend property, not a change in the control's color property.
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
Read the webcomic at [ ]!
If you like "At Arm's Length", support it at [ ].

More information about the Use-livecode mailing list