Within Interface Builder I’d like to be able to create a window that allows the user to resize, but will maintain it’s current aspect ratio. How can I lock the proportion without locking the window size itself?
Connect both of the following handlers to the window and add the ‘winProportion’ property to the script’s head…
property winProportion : 0
on awake from nib theObject
set {winWidth, winHeight} to size of theObject
set winProportion to (winWidth / winHeight)
end awake from nib
on will resize theObject proposed size proposedSize
set {tmpWidth, tmpHeight} to proposedSize
return {tmpWidth, (tmpWidth / winProportion)}
end will resize
j
Works like a charm. Thanks.