• 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
NSView + NSScrollView, not scrolling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSView + NSScrollView, not scrolling


  • Subject: NSView + NSScrollView, not scrolling
  • From: qvacua <email@hidden>
  • Date: Sat, 05 May 2012 09:31:03 +0200

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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: NSView + NSScrollView, not scrolling
      • From: Andy Lee <email@hidden>
    • Re: NSView + NSScrollView, not scrolling
      • From: Andy Lee <email@hidden>
    • Re: NSView + NSScrollView, not scrolling
      • From: Stephane Sudre <email@hidden>
  • Prev by Date: Re: Are there any way to update NSPanel content during dragging the panel ?
  • Next by Date: Re: NSView + NSScrollView, not scrolling
  • Previous by thread: Re: Strange issue in stroking a bezier path
  • Next by thread: Re: NSView + NSScrollView, not scrolling
  • Index(es):
    • Date
    • Thread