Page 5 of 5
Re: Send the Stack to the Center of the screen.
Posted: Sun Dec 17, 2023 11:12 am
by richmond62
This is a big pain-in-the-bum:
-
-
But with some sort of scaling being able to happen things could get considerably better:
-
-
keyBoardActivated being made available on LC Desktop would be a great boon.
Re: Send the Stack to the Center of the screen.
Posted: Sun Dec 17, 2023 9:50 pm
by bn
Here is a stack that simplifies setting the loc of a scaled stack. I has a handler 'setLocation' that is generic enough to be used in other projects (button 'setLoc')
After Stam's very useful explanation and sample stack at the beginning of this topic I figured that a simple way to handle moving scaled stacks would be useful.
It boils down to this
Code: Select all
put "number", "number" into tTargetLoc
put the scaleFactor of stack "myStack" into tScale
put item 1 of targetLoc / tScale into item 1 of tTargetLoc
put item 2 of targetLoc / tScale into item 2 of tTargetLoc
set the topLeft of stack "myStack" to tTargetLoc
That is it and it works.
I added the case that you want to move a scaled paletted stack. I turns out that LC apparently thinks for the top that the title bar of a stack is always the title bar of a topLevel stack which does not quite work for paletted stacks (or I did not find out how).
I resorted to a stunt that creates an invisibe stack on the fly and calculates the difference of the height of the title bar between a toplevel version and a paletted version and added that difference to the coordinates.
Kind regards
Bernd
Re: Send the Stack to the Center of the screen.
Posted: Wed Mar 27, 2024 10:44 am
by richmond62
I'm a little puzzled by the slippage of your revMenuBar though
Whose revMenuBar would you be referring to? Your comment is a bit decontextualised.
----------
Oh, and as this is you first postage, welcome to these forums.
How long have you been working with LiveCode?