I have got a very basic question about NSScrollView. I embedded my
custom NSView into an NSScrollView using Xcode's "Embed In..." menu
item. The following is my custom NSView:

@implementation MyView

- (void)drawRect:(NSRect)dirtyRect {
    [[NSColor yellowColor] set];
    NSRectFill([self frame]);
}

- (void)keyDown:(NSEvent *)theEvent {
    unichar key = [[theEvent characters] characterAtIndex:0];
    NSLog(@"\\U%X pressed", (int)key);

    [self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
}

- (BOOL)acceptsFirstResponder {
    return YES;
}
@end

In "applicationDidFinishLaunching:" I set the frame size of the view
to something big using setFrameSize.

What I want — but now working — is scrolling via Page Up/Down key. If
I understand the doc correctly, I just have to call
"interpretKeyEvents:" like above  and since MyView does not respond to
appropriate messages, the responder chain will forward the messages to
the scroll view. However, it does not scroll. What am I missing?

Thanks in advance.

Tae

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to