40.1 Overview

Scrollcanvas class creates a canvas with scrollbars attached. You can draw custom graphics to this canvas via a paint callback that is automatically invoked whenever content needs to be drawn. You just need to set up a notification on the Scrollcanvas.Paint attribute and your event handler will be called whenever content needs to be drawn. The same thing can be achieved by embedding a widget derived from Hollywood class inside a scrollgroup or connecting such a Hollywood widget to scrollbars but Scrollcanvas class is preferable in some cases because it is optimized especially for scrolled content, i.e. it tries to minimize painting by using OS widgets which are specifically designed for displaying scrolled content. Thus, it is usually faster than the two solutions outlined above.

You can set the canvas dimensions by using the Scrollcanvas.VirtWidth and Scrollcanvas.VirtHeight. Since Scrollcanvas class uses scrollbars, the dimensions of the canvas can obviously be much bigger than the physical dimensions of the scrollcanvas widget. As with all other classes, you can set those physical dimensions using the generic Area.Width and Area.Height attributes.

To force a complete redraw of your widget, just run the Area.Redraw method on your object. Running Area.Redraw on your object will result in your paint function being called so that you can update the canvas accordingly.

Show TOC