Red dot breakpoints not hit in resizeStack handler

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Cairoo
Posts: 107
Joined: Wed Dec 05, 2012 5:54 pm

Red dot breakpoints not hit in resizeStack handler

Post by Cairoo » Mon Nov 14, 2022 9:50 am

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.

stam
Posts: 2637
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Red dot breakpoints not hit in resizeStack handler

Post by stam » Mon Nov 14, 2022 10:53 am

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...

Cairoo
Posts: 107
Joined: Wed Dec 05, 2012 5:54 pm

Re: Red dot breakpoints not hit in resizeStack handler

Post by Cairoo » Mon Nov 14, 2022 11:54 am

@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?

stam
Posts: 2637
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Red dot breakpoints not hit in resizeStack handler

Post by stam » Mon Nov 14, 2022 12:02 pm

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...

Cairoo
Posts: 107
Joined: Wed Dec 05, 2012 5:54 pm

Re: Red dot breakpoints not hit in resizeStack handler

Post by Cairoo » 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.

stam
Posts: 2637
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Red dot breakpoints not hit in resizeStack handler

Post by stam » Mon Nov 14, 2022 1:23 pm

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?

Cairoo
Posts: 107
Joined: Wed Dec 05, 2012 5:54 pm

Re: Red dot breakpoints not hit in resizeStack handler

Post by Cairoo » Mon Nov 14, 2022 1:39 pm

Silly me.

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9582
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Red dot breakpoints not hit in resizeStack handler

Post by dunbarx » Mon Nov 14, 2022 3:38 pm

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
Last edited by dunbarx on Mon Nov 14, 2022 3:42 pm, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9582
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Red dot breakpoints not hit in resizeStack handler

Post by dunbarx » Mon Nov 14, 2022 3:41 pm

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

stam
Posts: 2637
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Red dot breakpoints not hit in resizeStack handler

Post by stam » Mon Nov 14, 2022 5:23 pm

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...

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9582
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Red dot breakpoints not hit in resizeStack handler

Post by dunbarx » Mon Nov 14, 2022 8:23 pm

Stam.

AHA. OK, then.

Who knew?

Craig

Post Reply

Return to “Talking LiveCode”