Re: NSView + NSScrollView, not scrolling
Re: NSView + NSScrollView, not scrolling
- Subject: Re: NSView + NSScrollView, not scrolling
- From: Stephane Sudre <email@hidden>
- Date: Sat, 05 May 2012 03:24:54 -0700
A question that could give a better idea of the issue:
Is the scroller thumb visible?
On Sat, May 5, 2012 at 12:31 AM, qvacua <email@hidden> wrote:
> 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.
_______________________________________________
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