Scrambled bounds

Can anyone explain how this occurs?

		tell window "wndMain"
			set oldboundsL to bounds of text field "lblIssue"
			-- oldboundsL -> {7, 770, 98, 784}
			set boundsL to {7, 662, 98, 676}
			set bounds of text field "lblIssue" to boundsL
			set newboundsL to bounds of text field "lblIssue"
			-- newboundsL -> {663, 8, 676, 98}
		end tell

It appears that {left, bottom, right, top} suddenly becomes {bottom, left, top, right}, and the bottom and left get shifted a pixel. “bounds” is a bounding rectangle as the dictionary defines it - I think this is a list as opposed to a record. What would cause it to change order and size?

All that I can remember doing is in Interface Builder in the Inspector window under “Size” I flipped back and forth with “Bottom/left:”, “Top/right:” etc. but that doesn’t affect anything but the position readings, right? And anyhow, I put it back the way it was. Thanks in advance for any possible explanations.

Edit - I notice now that it’s afflicted every control in the window and even the dimensions of the window itself when I get its bounds and resize it. Is there a global property or something that dictates the orientation or “bounds order” of all controls and windows?

I came across the coordinate system property of the application class and, as the Studio Reference document suggests, I entered

in the Info.plist file, but the problem remains.

  • Dan

This doesn’t happen here. What is your OS/Processor? Do you have QuarkXPress installed in your machine?

jj -

I’m running OS 10.4.6 on a G4 PowerBook, Xcode is 2.2.1, Interface Builder is 2.5.3. Yes, I do have Quark 6.5 installed (plus 4 and 5 in Classic), and usually run it as checked out from our Quark server, although not today.

There’ve been no recent changes, though, and this application just developed this problem after rebuilding it today.


  • Dan

Hi Dan,

some time ago I had an identical issue. I guess jj is right. My problem was solved after removing the scripting addition which was installed with QuarkXpress: QXPScriptingAdditions.osax (in Library/ScriptingAdditions).


jj, Dominik - You’re amazing. I never in a hundred years would have suspected that, but that’s what it was. I removed QXPScriptingAdditions.osax and suddenly it began working correctly. Why does a Quark scripting addition affect an Xcode app that has nothing to do with Quark? I suppose I’ll have to move it in and out of there as needed. Anyhow, thanks!

  • Dan

I think Quark’s scripting addition modifies the ‘rect’ structure, and it affects anything involving the “bounds” keyword. Well, I thought. You discovered how it does the job :wink:

Well, this has gone from a mere curiosity to a panic-inducing urgency…

I was under the impression that this was a build-time issue and as long as the osax was removed when the app was built then no problem. I just began rolling this out for testing and it runs fine on other stations UNTIL THEY USE QUARK! And then…!!! Oh no - it’s a run-time issue.

Does anyone have any advice to get around this? This script will be running at dozens of stations, not all within our company, and I can’t ask them to remove their Quark scripting additions before running, it’s just out of the question.

Like, incredible gratitude to anyone who can guide me through this. As I type this, the thought of Obj-C call methods occurs to me…

/returning to straw-grasping


  • Dan

Not sure if this is the rigth way, but seemed to work here:

	tell window "foo"
		set o to call method "frame" of text field "blah" --> old bounds
		call method "initWithFrame:" of text field "blah" with parameters {{a,b,c,d}} --> new bounds
		update it
	end tell

as far as I know all init… methods are intended for creating new objects. I’d try using the method ‘setFrame:’ instead.

Check the documentation of NSView for details …

Thanks very much guys - once my internet problems are taken care of this evening (argh, when it rains, it pours) I’m jumping right on this. I appreciate it very much…

  • Dan

No surprise, your suggestion works perfectly! :smiley: From your reference to the Cocoa AppKit docs (to see NSView) I was also able to find how to correctly resize the window (setFrame:display:). Thanks very much to both of you for bailing me out here…

  • Dan