autoscroll when receiving drags

  • Hi,
    I have a problem with the autoscroll functionality.

    What I have is basicly a Table View of Images BUT implemented as a
    custom NSView inside a NSScrollView
    all ok :) My list works fine

    Now I implemented the DraggingDestination protocol.
    I can receive drags from other views and apps just fine
    -draggingEntered is called
    -draggingUpdated is called periodicly
    all ok again :)

    Now though comes the issue:
    I want to implement autoscroll so the user can scroll while dragging
    For that I do [self autoscroll:[[sender destinationWindow]
    currentEvent]];

    - When I receive 'local drags' meaning from anywhere inside the same
    window all is good. The scrollView correctly scrolls when the user is
    close to the border of my view
    - When I receive drags from anywhere else (e.g. from the finder)
    atoscroll goes crazy and scrolls to the bottom of the ScrollView at
    which it gets stuck. (Apart from the autoscroll drags work)

    My hunch is that it's something to do with a wrong event. Maybe
    dragging from external windows ccauses no event to be generated for
    the target windo? So I access a wrong event during draggingUpdated :/

    Anyone got an idea? I cant be the first to do that... or is that
    simply not possible or a bug? Or should I not use autoscroll at all
    here?

    Regards,
    Dominik
  • Sorry to have wasted your time. Dont know why I missed this entry on
    cocoaDev: http://www.cocoadev.com/index.pl?AutoScrolling
    It explains that you should only scroll on LDragged events. Not
    simply for EVERY event :)

    Regards,
    Dominik

    Am 04.09.2007 um 23:17 schrieb Dominik Pich:

    > Hi,
    > I have a problem with the autoscroll functionality.
    >
    > What I have is basicly a Table View of Images BUT implemented as a
    > custom NSView inside a NSScrollView
    > all ok :) My list works fine
    >
    > Now I implemented the DraggingDestination protocol.
    > I can receive drags from other views and apps just fine
    > -draggingEntered is called
    > -draggingUpdated is called periodicly
    > all ok again :)
    >
    > Now though comes the issue:
    > I want to implement autoscroll so the user can scroll while dragging
    > For that I do [self autoscroll:[[sender destinationWindow]
    > currentEvent]];
    >
    > - When I receive 'local drags' meaning from anywhere inside the
    > same window all is good. The scrollView correctly scrolls when the
    > user is close to the border of my view
    > - When I receive drags from anywhere else (e.g. from the finder)
    > atoscroll goes crazy and scrolls to the bottom of the ScrollView at
    > which it gets stuck. (Apart from the autoscroll drags work)
    >
    > My hunch is that it's something to do with a wrong event. Maybe
    > dragging from external windows ccauses no event to be generated for
    > the target windo? So I access a wrong event during draggingUpdated :/
    >
    > Anyone got an idea? I cant be the first to do that... or is that
    > simply not possible or a bug? Or should I not use autoscroll at all
    > here?
    >
    > Regards,
    > Dominik
previous month september 2007 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
Go to today