• 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
Re: Window Placement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Window Placement


  • Subject: Re: Window Placement
  • From: "Clark S. Cox III" <email@hidden>
  • Date: Thu, 7 Nov 2002 10:51:04 -0500

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Thursday, Nov 7, 2002, at 06:56 US/Eastern, email@hidden wrote:

I'm trying to use the following code to get a perfect placement for my window:

NSRect *d;
NSScreen *screen = [NSScreen mainScreen];
d = [screen frame];
[[winControl window] setFrame:[NSRect x:[[d width]/2-500/2] y:[[d
height]/2-500/2] w:700 h:500] display:NO];

But for some reason I get 2 errors trying to run it:
following
AppController.m:121: incompatible types in assignment
AppController.m:122: parse error before "NSRect"

Any ideas?

NSRect is not a class, it is a simple C structure. Try this:

NSScreen *screen = [NSScreen mainScreen];
NSRect d = [screen frame]; //Notice, no '*'
[[winControl window] setFrame: NSMakeRect(d.size.width/2-500/2, d.size.height/2-500/2, 700, 500) display:NO];



- -- http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)

iEYEARECAAYFAj3Ki+0ACgkQd6STocYT1xWwcACgmagwhoLcucoi0sOcwAsiAu7e
jhIAn1izdlIGHoH7W/mtUeXgfcJ1xnYj
=eqdS
-----END PGP SIGNATURE-----
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Window Placement (From: email@hidden)

  • Prev by Date: Re: Window Placement
  • Next by Date: [OT] iNet Unix Tools on OS X
  • Previous by thread: Re: Window Placement
  • Next by thread: RE: Window Placement
  • Index(es):
    • Date
    • Thread