Padre::Wx::ScrollLock(3) Lock objects to prevent unintended scrolling

SYNOPSIS


SCOPE: {
my $lock = $padre_wx_treectrl->lock_scroll;

# Change the tree here
}

# The tree will unlock before here

DESCRIPTION

By default several Wx objects will auto-scroll to the location of an expand event or similar actions, as if it had been triggered by a human.

This class provides an implementation of a ``scroll lock'' for short-lived sections of fully self-contained code that will be updating the structure or content of a tree control or other scrolling object.

When created, the lock will create a Wx update locker for speed and flicker free changes to the object. It will also remember the current scroll position of the object.

When destroyed, the lock will move the scroll position back to the original location if it has been changed in the process of an operation and then release the update lock.

The result is that all operations on the object should occur with the tree appearing to stay fixed in place.

Note that the lock MUST be short-lived, as it does not integrate with the rest of Padre's locking system. You should already have all the data needed to change the object prepared and ready to go before you create the lock.

TODO

Find a way to prevent scrolling in native Wx and remove this class entirely. This whole exercise feels like a bit of a waste of time, because it emulates a more simple behaviour out of complex behaviour just because we can't disable the complex behaviour.

COPYRIGHT

Copyright 2008-2013 The Padre development team as listed in Padre.pm.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.