Page 1 of 1

Resize Stack only once

Posted: Wed Feb 23, 2022 1:45 pm
by hrcap
Hi Everybody

I hope that you are all well.

I have a card with a lot of objects on, as such when I drag resize the repositioning of the objects is very stuttery.

Is there a way to only reposition the objects once the resize is complete, something like:

Code: Select all


on resizestack

if mousedown = "false" then
      set_locs
end if

end resizestack


*set_locs is the command that repositions the objects.




Many Thanks

Re: Resize Stack only once

Posted: Wed Feb 23, 2022 2:53 pm
by dunbarx
Hi.

A stack with hundreds of controls can be resized by hand without issue. Do you mean that the controls themselves are to be resized along with the stack? Or do you mean thousands of controls? There is a sort of "stuttery" delay if that number live on a card.

Craig

Re: Resize Stack only once

Posted: Wed Feb 23, 2022 3:03 pm
by richmond62
I would assume the OP's
once the resize is complete
is a way to avoid the
very stuttery
perhaps s/he needs to check out lockScreen.

Whether the OP wants only repositioning,

or repositioning and proportional resizing is unclear.

Re: Resize Stack only once

Posted: Wed Feb 23, 2022 3:23 pm
by SparkOut
There's a couple of possible things but you could try something like this

Code: Select all

on resizestack 
   if mousedown = "false" and "set_locs" is not in the pendingMessages then 
      send "set_locs" to me in 300 milliseconds 
      -- or this card/this stack/whatever appropriate target
      -- or in suitable time delay
    end if
end resizestack
if you want to do proper triggering only to fire once for certain, however long the resize takes, you could deliberately cancel any "set_loc" message in the pendingMessages before sending a new message.

Re: Resize Stack only once

Posted: Wed Feb 23, 2022 3:52 pm
by hrcap
Perfect thanks chaps

The main problem with the stuttering is because there is a datagrid on the layout which adjusts the height of each of its rows depending on its contents.

I gave the lock screen a go but couldn't get this to work.

I am successfully using:

Code: Select all


   if "set_locs" is not in the pendingMessages then 
      send set_locs to me in "300" milliseconds
   end if


Many Thanks

Re: Resize Stack only once

Posted: Wed Feb 23, 2022 3:59 pm
by Klaus
Some hints:
We do not need to use "lock screen" in resizestack handler:
The screen is locked while a resizeStack handler is running, so it is not necessary to use the lock screen command to prevent changes from being seen. (However, the lockScreen property is not set to true.)
And MOUSEDOWN is a message and not a function, means it will always return FALSE, if the mouse is down or not.

Re: Resize Stack only once

Posted: Wed Feb 23, 2022 4:40 pm
by dunbarx
I think what Sparkout meant was "if the mouse is up".

The way is was written was as if "mouseDown" was a variable, and contained the string "false'. In fact LC allows this:

Code: Select all

put "false" into mouseDown
but it is likely, um, not very good practice. Anyway, that is why no error was thrown...

Craig

Re: Resize Stack only once

Posted: Wed Feb 23, 2022 6:02 pm
by Klaus
Just saying, Craig. :-)

Re: Resize Stack only once

Posted: Wed Feb 23, 2022 6:17 pm
by SparkOut
Yes I am working on phone and just copied the op script. I meant

Code: Select all

if the mouse is not down and...
And when using "send" then always quote the message to be sent.