Page 1 of 1

ResizeStack not responding to breakpoints

Posted: Mon Apr 24, 2017 8:11 am
by ittarter
Hi all,

So I have a substack and I've written a resizestack handler into the CARD of that substack. But for some reason even though I've put breakpoints into the code like I always do, the code doesn't stop and open the script window so that I can check local variables etc. The resizestack code is being triggered, though, but it's just frustrating because I can't debug it like I normally do.

Subsequent handlers that I call inside of the resizestack handler ALSO are immune to breakpoints :(

Livecode 8.1.2

Is this normal? Besides writing more code to "put" or "answer" the variables at each step, is there something else I can do to debug my script?

EDIT: Just read another post and it sounds like ResizeStack is not working as decribed in the dictionary. So maybe all the stuff I've read on ResizeStack online is obsolete, like the solution described here to handle multiple resolutions http://forums.livecode.com/viewtopic.php?f=8&t=14859 -- does that stuff still even work?

p.s. Code below for posterity's sake. Sorry it's not well-written as I haven't worked much with resize stuff and I haven't been able to debug it yet!

Code: Select all

on resizeStack --newWidth, newHeight
   if the width of this stack < item 3 of the screenRect then
      set the cRect of me to the screenRect --e.g. 0,0,1536,864 i.e. FULL SCREEN
   else
      put the rect of this stack into tRect
      put (item 3 of the screenRect / 10) into item 1 of tRect --LEFT: 10% from screen left
      put (item 4 of the screenRect / 10) into item 2 of tRect --TOP: 10% from screen top
      put (item 3 of the screenRect / 1.5) into item 3 of tRect --RIGHT: 67% of the screen width
      put 110 + (item 3 of tRect * 6 div 10) into item 4 of tRect --BOTTOM: proportional to stack height
      set the cRect of me to tRect
   end if
      --DO NOT resize IF bottom corner is invisible,
      --or if stack width < 350 or stack height < 310
   if item 3 of tRect < 350 or item 4 of tRect < 310 then
      exit resizeStack
   end if
   --pass resizeStack
   send "repositionObjects" to this card
end resizeStack

Re: ResizeStack not responding to breakpoints

Posted: Mon Apr 24, 2017 10:44 am
by Klaus
Maybe you also want to take a look at this thread, which is not 4 years old, only 2 weeks :D
http://forums.livecode.com/viewtopic.php?f=7&t=29115

Re: ResizeStack not responding to breakpoints

Posted: Mon Apr 24, 2017 11:20 am
by LiveCode_Panos
Hi all,

I think that any breakpoints in "resizestack" and "movestack" will NOT be triggered. Moreover, any errors in those handlers will be ignored.

This is a bug. In fact, this change was done on purpose in order to temporarily tackle a long standing (and more serious IMO) bug where the IDE became non-responsive and eventually crashed if there were any errors in the resizeStack or moveStack handlers (see bug 2867 and its many duplicates).

So we thought temporarily it is better to ignore errors in those two handlers as a better alternative to an IDE hang.

See https://github.com/livecode/livecode-ide/pull/1273 for more details.

We plan to rework this in the future.

Best regards,
Panos

Re: ResizeStack not responding to breakpoints

Posted: Tue Apr 25, 2017 12:14 am
by ittarter
Klaus: I was in fact referring obliquely to this thread in my edit, although I did not link it.

Panos: Thanks for confirming my suspicions!