NSDrawer delegate function mis-described?
NSDrawer delegate function mis-described?
- Subject: NSDrawer delegate function mis-described?
- From: "Ben Kennedy" <email@hidden>
- Date: Mon, 27 Jan 2003 16:46:35 -0500
- Organization: Zygoat Creative Technical Services
Hi all,
I am trying to implement code to keep an NSDrawer (attached to a document
window) at a fixed size when the user resizes the parent window.
According to the doc, I should be able to override the delegate method
drawerWillResizeContents:toSize:. However, this method appears only to
be called when the drawer itself is being resized manually, and NOT when
the parent window is resized. Quoth the doc,
>
Invoked when the user resizes the drawer or parent. contentSize contains
>
the size sender will be resized to. To resize to a different size, simply
>
return the desired size from this method; to avoid resizing, return the
>
current size. [...]
Is this a bug in the implementation, or in the doc?
More to the general point, can anyone suggest how to achieve what I want
to do? It seems that the "content size" of the drawer is ignored in
favour of the leading and trailing edge sizes; for example, putting a
call to [drawer setContentSize:NSMakeSize(100,100)] in the parent
window's windowDidResize: delegate implementation causes the drawer to
resize to 100 wide, but its height still varies as per the trailing edge
value (the 100 width value is ignored).
So, instead I have tried adjusting the trailing edge value in
windowDidResize: instead. Unfortunately, this only works for sizing the
window larger -- not smaller. The window is only allowed to grow, and is
prevented from shrinking. I suspect this is because I also have resize
increments set on the window (such that it is only allowed to size
vertically in intervals of ~150 pixels), and the system is noticing that
the drawer's current trailingOffset is too large to allow the window to
shrink by the increment. It's a chicken/egg situation. I have tried
moving the drawer adjustment to windowWillResize:toSize: instead, but
this results in ugly flicker as the drawer size flips around repeatedly.
Clearly 'didResize' is preferable to 'willResize' for such an adjustment.
Ideas? Surely the problem of a fixed-size drawer has been tackled before...
-ben
--
Ben Kennedy, chief magician
zygoat creative technical services
613-228-3392 | 1-866-466-4628
http://www.zygoat.ca
_______________________________________________
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.