"set bounds" and unexpected vertical offset
"set bounds" and unexpected vertical offset
- Subject: "set bounds" and unexpected vertical offset
- From: "Tom Harrington" <email@hidden>
- Date: Mon, 16 Jul 2007 17:56:49 -0600
I'm seeing some strange behavior in a script which I've reduced to the
following demo code:
tell application "TextEdit"
activate
set targetBounds to bounds of window index 1
end tell
tell application "Terminal"
activate
set bounds of window index 1 to targetBounds
get bounds of window index 1
end tell
What this should do is get the bounds of a TextEdit window, and set
the bounds of a Terminal window to be the same.
This works fine-- on a system with only one display, or on the primary
display of a multi-display system.
If I move the TextEdit window to a secondary display, the Terminal
window will not be at the correct location after setting its bounds.
Instead it will be offset vertically, by a distance equal to the
difference in pixel heights between the secondary and primary
displays. For example if the primary display is 1024 pixels high and
the secondary is 900 pixels high, the Terminal window will be offset
by 124 pixels from the TextEdit window. If the displays are the same
height then there's no difference.
In some cases-- and I haven't been able to work out exactly when-- the
bug only manifests in the above code if the "set bounds" statement is
executed twice (i.e. just duplicate that line). In my actual code
this isn't necessary, though.
Why would I get different behavior depending on the locations of the
windows? I've checked this on a couple of different Macs (both PPC
and Intel) with the same results.
--
Tom Harrington
email@hidden
AIM: atomicbird1
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden