Problem with smooth scrolling in Cocoa

  • Hello!

    Could anybody comment on the following problem, please?

    I need to implement some custom behavior in NSTextView scrolling, in
    particular I need to highlight some word and update correspondent
    information in other controls. For this I've inherited from
    NSTextView and overridden the methods like moveDown:, moveUp:,
    scrollPageDown:, scrollPageUp:.

    The scrollPageUp: method now looks like this:

    - (void) scrollPageUp: (id) sender
    {
        [super scrollPageUp: sender];
        [self afterScrollPage];
    }

    In the afterScrollPage method, with help of -[NSView visibleRect] I
    determine the visible characters rectangle and check if the currently
    selected word lies in that rectangle. But all this code works fine
    only when Use Smooth Scrolling is not selected in the Appearance
    panel of System Preferences. If it is selected then in the point of
    call of the afterScrollPage method above the -[NSView visibleRect]
    method return the incorrect rectangle: not as it's became after
    scrolling, but as it was before.

    Is it a bug or maybe I just do something wrong? Maybe there is some
    sort of notification that can help to reliably catch the moment when
    the scrolling has finished, so that -[NSView visibleRect] will return
    the proper value?

    Thanks in advance,
    Aleksandr Skobelev
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today