stack height anomaly

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
AlexAdams
Posts: 38
Joined: Sat Jan 17, 2009 8:49 pm
Contact:

stack height anomaly

Post by AlexAdams » Thu Aug 13, 2009 6:53 pm

I'm using Enterprise version 3.5 build 870

When I execute the following code I end up with a stack height of 630 instead of 280. Can you tell me why?

on mouseUp
local lvTop
local lvLocation
local lvLocationHorizontal
local lvLocationVertical
local lvCurrentHeight
local lvHalfCurrentHeight
local lvNewLocationVertical

put the location of this stack into lvLocation
put the first item of lvLocation into lvLocationHorizontal
put the second item of lvLocation into lvLocationVertical

put the height of this stack into lvCurrentHeight
put lvCurrentHeight/2 into lvHalfCurrentHeight
put lvLocationVertical-lvHalfCurrentHeight into lvTop

put lvTop + 140 into lvNewLocationVertical
put lvNewLocationVertical into lvLocationVertical
put lvLocationHorizontal & "," & lvLocationVertical into lvLocation
set the location of this stack to lvLocation
set the height of this stack to 280
set the width of this stack to 684
set the height of stack "stkConnections" to 310
end mouseUp

Thanks,
Alex Adams
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Thu Aug 13, 2009 7:38 pm

Alex,

your script works perfectly for me (I commented out the last line with "stkConnections")
Dimensions as you set them to 684 by 280, location seems OK.

maybe you have another script that prevents this script from working, something on resizeStack?

did you try your script in a newly created stack with just the one button?

regards
Bernd

AlexAdams
Posts: 38
Joined: Sat Jan 17, 2009 8:49 pm
Contact:

This is what I've found

Post by AlexAdams » Thu Aug 13, 2009 9:43 pm

:shock:

It has to do with another stack open as a drawer from the right of the stack being resized.

If the parent stack is at max size when the drawer is opened, then the contractStack handler will not resize smaller than a certain amount. Once this attempt has been made the parent stack cannot henceforth be contracted past the false size limit. If I uncheck the resize button in the property manager then all is fine no matter what the drawer does. If I recheck the resize box then the contract and expand handlers work fine until the drawer is opened with the window expanded.

What I have done to get around this is to add code to the handler that opens the drawer. I now close the drawer and resize the stack to the contracted size before opening the drawer again. With these added steps it will work fine every time. These steps produce some interesting visual effects, though unneccessary and a little annoying after a while.

I think the size of the drawer is the key. When the stack is expanded there is plenty of room to center the drawer, fully contained between the top and bottom of the parent window. Curiously, though, the drawer is taller than the parent window when the parent is contracted. The drawer opens and is initially quite short, but an openStack handler sets the drawer height to taller than the parent and all is fine.

Okay, I'm seeing this now. The drawer opens with a margin between the top of the drawer and the top of the parent stack and a margin between the bottom of the drawer and the bottom of the parent stack. When the drawer opens, it make some change to the parent window that locks in these margins. I wonder what these changes are and how to undo them?

Thanks for your help,
Alex Adams
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013

Post Reply