This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: Pleasant Scrolling Surprises
Feed Title: Michael Lucas-Smith
Feed URL: http://www.michaellucassmith.com/site.atom
Feed Description: Smalltalk and my misinterpretations of life
I've just finished the selecting code in WithStyle. It's one of those things you never think you're going to need to do.. write your own selecting algorithm. But it turns out that you do if you're building your own free layout text rendering widget.
Last night I had one more job on it to do.. if you drag the mouse outside the window, the scrolling area should scroll and keep selecting. To do this I knew I needed to grab and ungrab the mouse. Grabbing and ungrabbing the mouse allows you to keep track of its movements even when its outside your window.
But to my very surprise, once I'd grabbed and ungrabbed the mouse upon mouse up/down.. the window automatically scrolled when the mouse when outside its area! I believe this has to be a combination of the grabbing action, controller behaviour and the fact that my widget is subclassed off AutoScrollingView.
Needless to say I'm pleasantly surprised that I don't need to write this code myself. Object Orientedness wins again.