FROM : Steve Weller
DATE : Sat Mar 01 01:00:33 2008
I have a custom view into which I can draw a background color and a
centered rectangle. As the window is resized, the rectangle stays
centered and is clipped when the window gets small.
I want to define a canvas size slightly bigger than the rectangle and
have the scrollers appear when the available space is less than the
canvas needs. I override setFrameSize to do this:
- (void) setFrameSize:(NSSize)newSize
{
NSSize cSize;
cSize = [self canvasSize]; // Provides a size
// Use the larger dimensions of the two rects
if(newSize.width > cSize.width)
cSize.width = newSize.width;
if(newSize.height > cSize.height)
cSize.height = newSize.height;
[super setFrameSize:cSize];
}
And this works as long as the window is only made smaller. If the
window is made larger then the scrollers do not disappear.
Is my approach the right one for what I am trying to achieve?
If it is, how can I fix the scroller problem?
--
Blog: Photos: <A href="http://bagelturf.smugmug.com/">http://bagelturf.smugmug.com/
DATE : Sat Mar 01 01:00:33 2008
I have a custom view into which I can draw a background color and a
centered rectangle. As the window is resized, the rectangle stays
centered and is clipped when the window gets small.
I want to define a canvas size slightly bigger than the rectangle and
have the scrollers appear when the available space is less than the
canvas needs. I override setFrameSize to do this:
- (void) setFrameSize:(NSSize)newSize
{
NSSize cSize;
cSize = [self canvasSize]; // Provides a size
// Use the larger dimensions of the two rects
if(newSize.width > cSize.width)
cSize.width = newSize.width;
if(newSize.height > cSize.height)
cSize.height = newSize.height;
[super setFrameSize:cSize];
}
And this works as long as the window is only made smaller. If the
window is made larger then the scrollers do not disappear.
Is my approach the right one for what I am trying to achieve?
If it is, how can I fix the scroller problem?
--
Blog: Photos: <A href="http://bagelturf.smugmug.com/">http://bagelturf.smugmug.com/
| Related mails | Author | Date |
|---|---|---|
| Steve Weller | Mar 1, 01:00 | |
| Quincey Morris | Mar 1, 01:46 | |
| Steve Weller | Mar 1, 03:10 | |
| Quincey Morris | Mar 1, 03:40 | |
| Quincey Morris | Mar 1, 04:31 | |
| Steve Weller | Mar 1, 06:31 | |
| Quincey Morris | Mar 1, 07:33 | |
| Steve Weller | Mar 1, 17:57 | |
| Kyle Sluder | Mar 1, 18:37 |






Cocoa mail archive

