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 TScale

TScale can be used in two different ways: (1) you may use it as a stand-alone component for displaying scales; (2) TScale may be used as a helper component within other components. Which way the component is used can be controlled by the property IsHelperComponent. If it is used as helper component, TScale may draw its contents on a foreign canvas. The use of a foreign canvas has to be set up by the property UseForeignCanvas. The position on the foreign canvas is controlled by the properties ForeignCanvasPosX and ForeignCanvasPosY.

The properties RangeLow and RangeHigh determine the range of the scale. In the case of logarithmic scales the range parameters have to be positive.

The colors of the scale are controlled by the properties ColorBackGnd and ColorScale, which determine the color of the background of the scale (provided that the property Transparent is not TRUE) and the color of the scale lines. Please note that the color of the scale labels depends on the property Font.Color (and not on ColorScale). The base line of the scale may be made invisible by setting the property ShowBaseLine to FALSE.

The margins of the scale can be selected by setting the properties MarginBottom, MarginLeft, MarginRight, and MarginTop. However, which of the margin properties are used depends on the orientation of the scale (see property ScaleType).

The Caption of the scale can be positioned by using the properties CaptionAlignment, CaptionAnchor, CaptionPosX, and CaptionPosY. The scale labels can be of various kinds (property LabelType) and can be modified by the properties DecPlaces and ScaleInscript. The format of date or time labels is specified by the property DateFormat.

The number of tick marks along the scale is controlled by the properties MinTicks and ShortTicks. As MinTicks specifies only the minimum number of required tick marks, the property NumTicks may be used to get the actual number of displayed tick marks (the tick marks are adjusted automatically to meet the 1-2-5 requirements of scales). The position of the tick marks can be obtained by using the array property TickPos.

If the property SuppressPaint is set to TRUE, the redrawing of the scale can be suppressed. This is especially useful when using the TScale component as a sub-component of another component. In order to trigger the repaint process when SuppressPaint if TRUE, you may either use the method ForcePaint, or set the property SuppressPaint to FALSE again.

TScale generates the following events which can be used to adjust the component to specific user requirements: the OnBeforeScaleRendered and OnAfterScaleRendered events are triggered immediately before and after the scale is rendered. These two events can be used to draw user specific elements on the scale canvas either below or on top of the scale. The event OnScaleTickDrawn is triggered for each scale tick. It can be used to modify individual scale ticks. If you need to know the pixel coordinates for a given scale value, you may use the method ConvertToPixelCoords to transform the scale value into pixel coordinates.


Last Update: 2013-May-14