• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[window frame] reporting wrong y coordinate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[window frame] reporting wrong y coordinate


  • Subject: [window frame] reporting wrong y coordinate
  • From: Eric Gorr <email@hidden>
  • Date: Wed, 22 Jul 2009 15:28:55 -0400

There is a sample application at:

http://www.ericgorr.net/cocoadev/WindowPosition.zip

and inside of the zip file is a screen shot (screen shot.tiff) of what I see when I run the application.

It shows the lower y coordinate of the window at -24 and the window is entirely on screen.

I have two screens connected to my machine.

The y coordinate [window frame] returns is only wrong when the resolutions of the two screens are different and the window is on the second screen (the one without the menubar).

In this particular instance, the resolution of the main screen was 1280x1024 and the resolution of the second screen was 1400x1050.

The code I wrote to get the coordinates of the window and put them on the window is:

- (void)windowDidMove:(NSNotification *)notification
{
	NSRect	myLocation = [[notification object] frame];
	NSString *myLocationString = NSStringFromRect( myLocation );
	[windowCoordinates setStringValue:myLocationString];
}


The amount it is off by may be related to the height of the menu bar on the main screen.


Perhaps [window frame] is supposed to work this way, but I would find that to be quite odd and have not found any documentation supporting this weird behavior.

I am running 10.5.7.

A bug will soon be filed with Apple.

p.s.
This situation is going to be seen by users with laptops who connect to a second, larger monitor - which is what several users of our application are doing and how this was discovered.







_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [window frame] reporting wrong y coordinate
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: Re: Cocoa-dev Digest, Vol 6, Issue 1051
  • Next by Date: Re: [window frame] reporting wrong y coordinate
  • Previous by thread: Re: Cocoa-dev Digest, Vol 6, Issue 1051
  • Next by thread: Re: [window frame] reporting wrong y coordinate
  • Index(es):
    • Date
    • Thread