The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Using TThumbnails

The unit Thumbnails provides a general approach for displaying previews of images as a slide catalog. Thumbnails has been especially designed with the goal of presenting large slide collections in mind. While conventional approaches (i.e. using the PaintBox component) are suitable for small collections where the extents of the slide collection does not exceed 32767 pixels in any direction, Thumbnails avoids these restrictions of the Windows canvas and thus is capable of displaying millions of slides.

This goal has been achieved by switching from precompiled thumbnail collections to the online calculation of slides. Thus you have to provide an image as a bitmap to the component when it requests it in the OnImageRequest event. TThumbnails takes this bitmap, scales it and displays it in the proper size as part of a thumbnail catalog. Please note that you can speed up the display of the component considerably if you provide images which are not too large. One of the more important parameters in the OnImageRequest event is the variable parameter HowToProcess, where you can specify how the requested image will be displayed. By default, HowToProcess is set to irpShowNothing - thus you have to set it to irpShowSlide in order to enable the display of a slide.

The overall appearance of the slide collection can be controlled by various properties - among them the color properties ColorBackGnd, ColorCover, and ColorMark; the properties controlling the frame styles (FrameStyle, InnerFrameStyle, OuterFrameStyle); and the properties determining the size and layout of the slides (SlideSize, SlideDistance, SlideMargin).

In order to show a certain part of the slide collection, you have to set the property FirstThumbIdx which controls the slide displayed in the top left corner of the collection. The TThumbnails component automatically adjusts the number of columns when resizing it. The current number of rows and columns can be obtained from the properties NumSlidesVert and NumSlidesHoriz, respectively. The parameters Min and Max determine the range of valid slide indices.

Hint: In order to create a scrollable slide view you should use a TScrollBar or similar component to control the property FirstThumbIdx.

When the mouse moves over a slide it receives the focus. The focused slide is indicated by a colored rectangle around the slide. The line width of the rectangle and its color can be controlled by the properties FocusLinewidth and ColorFocus, respectively. The index of the slide which has the focus can be obtained by reading the property FocusedSlide.

Slides may be selected either interactively by clicking them, or programmatically by setting the array property SlideSelected. The interactive selection may be restricted by setting the property SlideSelectMode. Selected files are displayed using the color ColorSelected for the color of the slide cover. The number of selected slides may be obtained from the method NumSlidesSelected, the index of the first selected slide may be obtained from the function FirstSelectedSlide.


Last Update: 2023-Feb-06