Mon 18 Aug 2008 05:13:37 AM UTC, original submission:
I am using GNUstep on an Ubuntu 8.04 system, installed using the GNUstep Startup package version 0.20.0. I am trying to complete the first exercise proposed by A. Hillegass in chapter 6 of his book "Cocoa programming for Mac OS X" (third edition). The exercise asks to write a delegate for a window that answers the "windowWillResize:toSize:" message.
It seems that GNUstep never calls this method. Here is the interesting part of the AppDelegate class I implemented (mainWindow is a pointer to the NSWindow I am resizing, its delegate has been set using Gorm):
- (NSSize) windowWillResize: (NSWindow *) window
toSize: (NSSize) proposedFrameSize
{
NSLog (@"windowWillResize:toSize: called");
return proposedFrameSize;
}
- (void) windowDidResize: (NSNotification *) aNotification
{
NSLog (@"windowDidResize: called");
}
- (void)applicationWillTerminate:(NSNotification *)aNotif
{
NSLog (@"Is the window's delegate correct? %d",
[mainWindow delegate] == self);
SEL selector = @selector (windowWillResize:toSize:);
NSLog (@"Does it respond to windowWillResize:toSize? %d",
[[mainWindow delegate] respondsToSelector: selector]);
}
This is the log I get when I try to resize "mainWindow" and then close the application:
2008-08-18 07:11:48.975 WindowWillResizeTest[14827] Ignore bottom offset change from 32 to 9
2008-08-18 07:11:48.976 WindowWillResizeTest[14827] Reparent was with offset 0 23
2008-08-18 07:11:48.976 WindowWillResizeTest[14827] Parent border,width,height 1,313,320
2008-08-18 07:11:52.579 WindowWillResizeTest[14827] windowDidResize: called
2008-08-18 07:11:53.513 WindowWillResizeTest[14827] Is the window's delegate correct? 1
2008-08-18 07:11:53.513 WindowWillResizeTest[14827] Does it respond to windowWillResize:toSize? 1
As you can see, there is a log message printed by windowDidResize but nothing from windowWillResize, despite the selector being correct.
I am using the default backend installed by GNUstep Startup:
$ defaults read NSGlobalDomain GSBackend
NSGlobalDomain GSBackend libgnustep-back
The full application source is attached.
|