Page 1 of 1

Red dot breakpoints not hit in resizeStack handler

Posted: Mon Nov 14, 2022 9:50 am
by Cairoo
Dear forum,

Has anyone had this problem where breakpoints in one card's resizeStack handler don't get hit, but do get hit in other cards' resizeStack handlers?

I've comfirmed that the resizeStack handler does run to completion for the card where the breakpoints don't hit. It's really puzzling.

Re: Red dot breakpoints not hit in resizeStack handler

Posted: Mon Nov 14, 2022 10:53 am
by stam
I don't think you can set breakpoints inside the resize handler.
Annoying isn't it ;)

I remember coming up against this at some point - I can't remember if outsourcing the action to another handler helped (called from on resizeStack), but bit it may be worth a try...

Re: Red dot breakpoints not hit in resizeStack handler

Posted: Mon Nov 14, 2022 11:54 am
by Cairoo
@Stam
I tried that and it only works when the outsourced handler is triggered with
send "outSourcedHander pNewWidth, pNewHeight, pOldWidth, pOldHeight" to the target in 0 milliseconds
or
dispatch "outSourcedHander" to the target with "pNewWidth, pNewHeight, pOldWidth, pOldHeight"

Have you perhaps filed a bug report for it when you came up against that?

Re: Red dot breakpoints not hit in resizeStack handler

Posted: Mon Nov 14, 2022 12:02 pm
by stam
Cairoo wrote:
Mon Nov 14, 2022 11:54 am
Have you perhaps filed a bug report for it when you came up against that?
No I didn't - but now that you mention it, I think I did the same as you - I called the script from the message box to test it worked. Once I was happy it worked I just called it from resizeStack. Or some such...

Note that according to the documentation:
Dictionary > ResizeStack wrote:Known issue:* Currently errors in moveStack and resizeStack are ignored, as this was causing a hang in the IDE.
This means that breakpoints won't work either, it's a known issue and presumably one that will be addressed in v10...

Re: Red dot breakpoints not hit in resizeStack handler

Posted: Mon Nov 14, 2022 1:18 pm
by Cairoo
Speaking of errors in the resizeStack handler,

the very code I've been trying to debug now throws an unexplained error.

I send a message called "resizeStack2" from the resizeStack handler. It takes the same parameters as the resizeStack handler; i.e.
pNewWidth, pNewHeight, pOldWidth, pOldHeight

When I do the following in resizeStack2:

Code: Select all

local tNewH
on resizeStack2 pNewWidth, pNewHeight, pOldWidth, pOldHeight
    -- the original height of the stack is 682
    if pNewHeight is empty then
    	put the height of this stack into tNewH
    else
    	put pNewHeight into tNewH
    end if
    put tNewH / 682 into theRatio
    -- use theRatio to resize other controls on the card ...
end resizeStack2
it throws the error
"execution error at line <whatever> (Operators /: error in left operand), char 1"
at the line "put tNewH / 682 into theRatio"

and checking the value of tNewH shows it contains an integer as one would expect, but for some reason the "/" operator has a problem with it.

Re: Red dot breakpoints not hit in resizeStack handler

Posted: Mon Nov 14, 2022 1:23 pm
by stam
Cairoo wrote:
Mon Nov 14, 2022 1:18 pm
Speaking of errors in the resizeStack handler,

the very code I've been trying to debug now throws an unexplained error.

I send a message called "resizeStack2" from the resizeStack handler. It takes the same parameters as the resizeStack handler; i.e.
pNewWidth, pNewHeight, pOldWidth, pOldHeight

When I do the following in resizeStack2:

Code: Select all

local tNewH
on resizeStack2 pNewWidth, pNewHeight, pOldWidth, pOldHeight
    -- the original height of the stack is 682
    if pNewHeight is empty then
    	put the height of this stack into tNewH
    else
    	put pNewHeight into tNewH
    end if
    put tNewH / 682 into theRatio
    -- use theRatio to resize other controls on the card ...
end resizeStack2
it throws the error
"execution error at line <whatever> (Operators /: error in left operand), char 1"
at the line "put tNewH / 682 into theRatio"

and checking the value of tNewH shows it contains an integer as one would expect, but for some reason the "/" operator has a problem with it.
Out of curiosity, if you just call resizeStack2 from a button or message box with some values (i.e. not through the resizeStack handler) does it still generate tis error?

Re: Red dot breakpoints not hit in resizeStack handler

Posted: Mon Nov 14, 2022 1:39 pm
by Cairoo
Silly me.

I mistyped one of the parameters sent to resizeStack2. After correcting it, no errors.

Re: Red dot breakpoints not hit in resizeStack handler

Posted: Mon Nov 14, 2022 3:38 pm
by dunbarx
Stam.
I don't think you can set breakpoints inside the resize handler.
Annoying isn't it ;)
What is so special about the resizeStack message, or rather a handler that might trap it, to disable the functionality of a red dot?

Craig

Re: Red dot breakpoints not hit in resizeStack handler

Posted: Mon Nov 14, 2022 3:41 pm
by dunbarx
And I assume this topic is unrelated to the fact that I am, once again, in v. 9.6.1, seeing red dots failing to "stick". I have to dismiss them and re-insert.

This was an ongoing problem for years, that was fixed many months ago. Well, was once fixed...

Craig

Re: Red dot breakpoints not hit in resizeStack handler

Posted: Mon Nov 14, 2022 5:23 pm
by stam
dunbarx wrote:
Mon Nov 14, 2022 3:38 pm
Stam.
What is so special about the resizeStack message, or rather a handler that might trap it, to disable the functionality of a red dot?

Craig

As mentioned above, LC ignores errors in resizeStack because it caused the IDE to hang. I think for the same reason, breakpoints are ignored as well:
stam wrote:
Mon Nov 14, 2022 12:02 pm
Note that according to the documentation:
Dictionary > ResizeStack wrote:Known issue:* Currently errors in moveStack and resizeStack are ignored, as this was causing a hang in the IDE.
This means that breakpoints won't work either, it's a known issue and presumably one that will be addressed in v10...

Re: Red dot breakpoints not hit in resizeStack handler

Posted: Mon Nov 14, 2022 8:23 pm
by dunbarx
Stam.

AHA. OK, then.

Who knew?

Craig