views:

12

answers:

1

Here is a snippet of code I have to handle smooth scrolling. here is the output of the NSLog:

2010-06-21 16:04:10.524 PDFViewWXOSX[80161:a0f] first error: -9870
2010-06-21 16:04:10.525 PDFViewWXOSX[80161:a0f] second error: 0
2010-06-21 16:04:10.552 PDFViewWXOSX[80161:a0f] first error: 0
2010-06-21 16:04:10.553 PDFViewWXOSX[80161:a0f] second error: 0
2010-06-21 16:04:10.582 PDFViewWXOSX[80161:a0f] first error: 0
2010-06-21 16:04:10.582 PDFViewWXOSX[80161:a0f] second error: 0
2010-06-21 16:04:10.588 PDFViewWXOSX[80161:a0f] first error: -9870
2010-06-21 16:04:10.589 PDFViewWXOSX[80161:a0f] second error: 0
2010-06-21 16:04:10.652 PDFViewWXOSX[80161:a0f] first error: 0
2010-06-21 16:04:10.652 PDFViewWXOSX[80161:a0f] second error: 0
2010-06-21 16:04:10.723 PDFViewWXOSX[80161:a0f] first error: 0
2010-06-21 16:04:10.723 PDFViewWXOSX[80161:a0f] second error: 0
            SInt32 scroll_delta_x = 0, scroll_delta_y = 0;
            OSErr err = noErr;

            err = GetEventParameter( cEvent, kEventParamMouseWheelSmoothHorizontalDelta, 
                                    typeSInt32, NULL, sizeof(scroll_delta_x), NULL, 
                                    &scroll_delta_x);
            NSLog(@"first error: %d", err);
            if (err == noErr) {
                deltaX = scroll_delta_x;
            }
            err = noErr;
            err = GetEventParameter( cEvent, kEventParamMouseWheelSmoothVerticalDelta, 
                                    typeSInt32, NULL, sizeof(scroll_delta_y), NULL, 
                                    &scroll_delta_y);
            NSLog(@"second error: %d", err);
            if (err == noErr) {
                deltaY = scroll_delta_y;
            }

I couldn't find any information on error -9870. What is going on?

+1  A: 

Error -9870 is eventParameterNotFoundErr, declared in CarbonEventsCore.h. The header comments on those event parameters say that you should be prepared for the possibility that they are not present.

JWWalker