Articles 3D Audio Custom Controls General RB Graphics Hacks Mac OS X Menus Novelty Printing REALbasic 2005 REALbasic 2006 Registration Resources Reviews Serial Speech Sockets XML Video Resource Links News Current News February 2006 January 2006 December 2005 November 2005 October 2005 September 2005 August 2005 July 2005 June 2005 May 2005 April 2005 March 2005 ![]() REALbasic for Dummies by Erick Tejkowski ![]() Learning REALbasic through Applications REALbasic for Macintosh REALbasic Cross-Platform Application Development
Older files are in Stuffit 5 or greater format. Newer files are ".Zip". Download StuffIt Expander |
|
Using New Features From REALbasic 2005!
New MouseWheel Event The parameters X and Y are the mouse coordinates relative to the control that has received the event. The parameter Delta is the number of scroll lines the wheel has been moved, as defined by the operating system. This value is positive when the user scrolls down and negative when scrolling up. Return True to prevent the event from propagating further into parent controls and, eventually, the window.
The Code
This method simply sets the maximum value of the scrollbars to be the size of the remaining portion of the image which isn't visible. It also checks the value of the scrollbar and makes sure it's in the proper range. This is because REALbasic doesn't seem to do this sometimes and can cause some really bad jumping in the image and it's quite ugly.
These two methods are called by the corresponding scrollbars. All they do is set the new offset the image should be drawn at and then refreshes the canvas so it redraws like so:
Note that we draw a chunk of the image from the given offset at 0, 0 in the canvas.
And here is the scroll wheel event. First we check to see if the shift key is held down. If it is, then we do a horizontal scroll, otherwise we do a vertical scroll. We multiply the delta value by the PageStep value because otherwise the canvas just scrolls too slowly and that's not what it should do.
Finished
|
||||
|
||||||||||||||||||||||||||||||||
Maintained by the Staff of ResExcellence. This entire site ©1997-2006 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement.
[an error occurred while processing this directive]