Page 1 of 1

Position Substack relative to mainstack

Posted: Wed Jan 04, 2017 4:37 pm
by mrcoollion
I am having troubles positioning a smaller substack relative to the position of the main stack or an object in the main stack.

Any help would be appreciated.

Regards,

Paul

Re: Position Substack relative to mainstack

Posted: Wed Jan 04, 2017 5:15 pm
by mrcoollion
Got it 8) ,

Mayby a bit elaborate but it works.
Any faster way's? Please let me know! :D

Code: Select all

   put the topLeft  of me into tsavedTopLeft // it the button that launches the substack. Can be any other object on the card.
   put item 1 of  tsavedTopLeft into tLeftMeCoordinate
   put item 2 of  tsavedTopLeft into tTopMeCoordinate
   put the TopLeft of this stack into tStackLocation
   put item 1 of  tStackLocation into tLeftCoordinate
   put item 2 of  tStackLocation into tTopCoordinate
   put -180 into tMoveLeftRight// This positions the SubStack hor-coordinate relative to the object (button that launches the substack in this case)
   put -100 into tMoveUpDown // This positions the SubStack vert-coordinate relative to the object (button that launches the substack in this case)
   add tTopMeCoordinate+tMoveUpDown to tTopCoordinate
   add tLeftMeCoordinate+tMoveLeftRight to tLeftCoordinate
   put tLeftCoordinate&","&tTopCoordinate into tSubStackLocation
   open invisible stack "theSubStackName"
   set the topLeft of stack "theSubStackName" to tSubStackLocation
   set the visible of stack "theSubStackName" to true

Re: Position Substack relative to mainstack

Posted: Wed Jan 04, 2017 5:35 pm
by Klaus
Dag Paul.

not sure I understand your problem correctly, but I would:

Code: Select all

...
## Use SCREEN coordinates directly!
put globalloc(the topLeft of me) into tsavedTopLeft

## Add H and V offset
add 180 to item 1 of tsavedTopLeft
add 100 to item 2 of tsavedTopLeft

## Set loc of substack, no need to open it invisible before!
set the topLeft of stack "theSubStackName" to tsavedTopLeft
go stack "theSubStackName"
...
Best

Klaus

Re: Position Substack relative to mainstack

Posted: Wed Jan 04, 2017 5:39 pm
by mrcoollion
LOL ... :D Knew it could be done much easier..

Bedankt !

Re: Position Substack relative to mainstack

Posted: Wed Jan 04, 2017 5:58 pm
by Klaus
Graag gedaan! :D

Re: Position Substack relative to mainstack

Posted: Wed Jan 04, 2017 6:20 pm
by dunbarx
Gesundheit.

I often locate a substack to the right of a mainstack by:

Code: Select all

...
   set the left of stack "subStack" to the right of stack "mainStack + 10
   set the top of stack "subStack" to the top of stack "mainStack"
Craig

Re: Position Substack relative to mainstack

Posted: Wed Jan 04, 2017 6:25 pm
by Klaus
dunbarx wrote:Gesundheit.
:D :D :D

Re: Position Substack relative to mainstack

Posted: Wed Jan 04, 2017 8:06 pm
by mrcoollion
Thanks Craig.... :D