Package peppy :: Package lib :: Module dropscroller :: Class ListDropScrollerMixin
[frames] | no frames]

Class ListDropScrollerMixin

object --+
         |
        ListDropScrollerMixin

Automatic scrolling for ListCtrls for use when using drag and drop.

This mixin is used to automatically scroll a list control when approaching the top or bottom edge of a list. Currently, this only works for lists in report mode.

Add this as a mixin in your list, and then call processListScroll in your DropTarget's OnDragOver method. When the drop ends, call finishListScroll to clean up the resources (i.e. the wx.Timer) that the dropscroller uses and make sure that the insertion indicator is erased.

The parameter interval is the delay time in milliseconds between list scroll steps.

If indicator_width is negative, then the indicator will be the width of the list. If positive, the width will be that number of pixels, and zero means to display no indicator.

Instance Methods
 
__init__(self, interval=200, width=-1)
Don't forget to call this mixin's init method in your List.
 
getDropIndex(self, x, y, index=None, flags=None)
Find the index to insert the new item, which could be before or after the index passed in.
 
processListScroll(self, x, y)
Main handler: call this with the x and y coordinates of the mouse cursor as determined from the OnDragOver callback.
 
finishListScroll(self)
Clean up timer resource and erase indicator.
 
OnAutoScrollTimer(self, evt)
Timer event handler to scroll the list in the requested direction.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, interval=200, width=-1)
(Constructor)

 

Don't forget to call this mixin's init method in your List.

Interval is in milliseconds.

Overrides: object.__init__

processListScroll(self, x, y)

 

Main handler: call this with the x and y coordinates of the mouse cursor as determined from the OnDragOver callback.

This method will determine which direction the list should be scrolled, and start the interval timer if necessary.