• 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
Resizing window to fit drawer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Resizing window to fit drawer


  • Subject: Resizing window to fit drawer
  • From: Jan Van Tol <email@hidden>
  • Date: Tue, 11 Mar 2003 21:29:17 -0600

List,

I'm trying to make my main window resize to fit a drawer on the screen, much like Camino does. To this end, I've written the following code:

NSRect drawerRect = [[[subscriptionsController drawer] contentView] frame];
drawerRect.origin.x = drawerRect.origin.x + [[[subscriptionsController drawer] contentView] frame].size.width;
drawerRect = [[[NSApp mainWindow] contentView] convertRect:drawerRect fromView:[drawer contentView]];
NSPoint drawerPoint = NSMakePoint(drawerRect.origin.x, drawerRect.origin.y);

NSLog(@"drawerPoint: %f", [[NSApp mainWindow] convertBaseToScreen:drawerPoint].x);
NSLog(@"mainScreen: %f", [[NSScreen mainScreen] visibleFrame].size.width);

No doubt I'm making a grievous mistake somewhere, but I can't see it. What I'm hoping for it to do, is to log the width of the screen (which works fine), and log the right edge of the drawer, in the screens coordinate system. Instead I get 1121 for the screen (correct), and 218 for drawerPoint. So what am I doing wrong? Also, am I going about this correctly, or is there some other way?

Thanks in advance,

-Jan Van Tol
_______________________________________________
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.

  • Prev by Date: Re: deallocation of related objects
  • Next by Date: Is there a Java Cocoa File Chooser Dialog?
  • Previous by thread: Re: deallocation of related objects
  • Next by thread: Is there a Java Cocoa File Chooser Dialog?
  • Index(es):
    • Date
    • Thread