Window resizing issues on some users machines

I have an app that expands its main window to display additional data entry fields. I use the triangle disclosure button object to do it, and there is also a button that does the same action. It should open the window only in the vertical direction. But some users are having an issue that it opens the window horizontally and screws up the UI. Is there any reason why this is happening? It is occurring on a 10.39 machine as well as a 10.4x. The app was built on 10.39 with xCode 1.5.
I could make the window be manually resizable, but that could circumvent some other safeguards I have in place that detect if the window has been expanded or not.
Suggestions appreciated!
Thanks, Chris

edit- also one of the main buttons moves to the side (one that uses a springy to change its position relative to window) instead of vertically.

Script that expands the window

on clicked the_object
	set object_name to name of the_object as string
	if object_name = "triangle" then
		if state of the_object = 0 then
			set the_delta to 470
			set the_delta to -470
		end if
		tell window of the_object
			set {x1, y1, x2, y2} to bounds
			set bounds to {x1, (y1 + the_delta), x2, y2}
		end tell
--a couple other statements here too
	end if
end clicked


What may be in your best interest, is to figure out exactly what the sizes of your individual content areas are, and then hard-code them into your app. For example, if you know that the window collapsed is 300px tall, and it needs to be 500px tall when expanded, then just write those sizes into your app, rather than trying to do math to make those adjustments. It sounds like you may already be completely restricting the user’s ability to resize manually anyways, so you should be able to determine what the window sizes need to be at any given time by building your interface to spec and then looking at it in IB. Ideally (such as in the system preferences) you would fix the size both horizontally and vertically, and handle ALL resizing programmatically. This allows you to maintain full control over the window frame at all times, and I would think allow you to eliminate all of your resizing bugs.

To help troubleshoot the root of the problem, my first question would be whether the problem is happening all the time, at certain specific times, or completely at random. If the behavior is predictable, then a solution is likely possible. The code you posted doesn’t seem to have any control over what your width or horizontal origin is. Try logging the bounds array any time you resize and checking the values to make sure you’re passing the desired variables back when you reset the bounds. The only other thing I can think of is that you might have a minimum or maximum value set for the size of the window that conflicts with the values you’re setting. If you try to set it to a value that’s outside it’s allowed size threshold, you may get unexpected results… but I’m not sure of that.

Obviously, make sure that there’s not other code you “forgot” about that’s also manipulating the window size. Automatic restoration of window frame from defaults, redrawing of content, etc. Perhaps there’s some other routine you wrote that’s managing the frame somewhere else that’s accidentally firing and resizing the window when you don’t expect it to?

Without more details and troubleshooting, or without seeing the project, there’s not much more I can offer. Typically, problems like this happen under a finite set of circumstances… it’s just a matter of recreating them and then figuring them out to find the problem.


As a workaround of your problem you might want to consider using a drawer for the extra data and keeping the main window at a fixed size.