Problem with setting the max height of a window in AS Studio

Hi there :slight_smile: I’m sorry if this question has been answered, but I haven’t found anything so far.

I’m building this project in AS Studio (learning at the same time) in which the main window can be resized to different views (code side). There are a total of three views, each have their specific height, but no specific width. What I do to change between views is resize the window using AS. As I still want the width to be resizable, I have no choice (it seems) but to leave growing enabled. To manage that I set the minimum height of the view to the same as the height of the view. I’ve managed to do that just fine, but then if set the maximum height also, so the user can’t grow the window to the next view, and try to resize the window something awfully weird happens.

http://i59.photobucket.com/albums/g288/xsmurf_photosster/35adf393.png

Here is a screenshot of the same view, resized, but without having set the max height

http://i59.photobucket.com/albums/g288/xsmurf_photosster/818904ad.png

As you can see it resizes just fine, albeit I could also resize the height of the window to anything bigger (but not smaller, obviously).

Here is my resizing function


on doSetPlayerDimensions()
	set root to window "winMain"
	set theBounds to the bounds of root
	set theMax to the maximum size of root
	set theMin to the minimum size of root

	set smallYWindow to ((item 4 of theBounds) - playerHeight) -- playerHeight is a property
	
	set item 2 of theBounds to smallYWindow
	set item 2 of theMin to playerHeight
	set item 2 of theMax to (playerHeight + 1)
	
	set the bounds of root to theBounds
	set the minimum size of root to theMin
	set the maximum size of root to theMax
end doSetPlayerDimensions

EDIT : Images didn’t seem to work so I also posted them as links…
EDIT : I realize the way the above script sets the bounds is wrong, I have corrected this, but the max size problem remains