ITabFormatScale.GetUsedIntervalsCount

Syntax

GetUsedIntervalsCount: Integer;

Description

The GetUsedIntervalsCount method is used to get index of scale interval by the index of interval in use.

Comments

To get the number of used scale intervals, use the ITabFormatScale.GetUsedIntervalIndex method.

Example

Executing the example requires that the repository contains an express report containing a table.

Place the components on the form: Button, UiErAnalyzer, TabSheetBox named Button1, UiErAnalyzer1, TabSheetBox1, respectively.

Set additional properties:

Add links to the Drawing, Express, Forms, and Tab system assemblies.

The example is a handler of the OnClick event for the Button1 component.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Tab: ITabSheet;
    Range: ITabRange;
    FormatCondition: ITabFormatCondition;
    Scale: ITabFormatScale;
Begin
    
// Get express report table
    Tab := TabSheetBox1.Source.GetTabSheet;
    
// Set conditional formatting for the selected table cells
    Range := Tab.View.Selection.Range;
    FormatCondition := Range.FormatConditions.Add;
    FormatCondition.Type := TabConditionType.Scale;
    
// Set conditional formatting
    Scale := FormatCondition.Details As ITabFormatScale;
    
// Cancel use of value autoselection
    Scale.UseAutoValues := False;
    
// Set the number of color scale intervals
    Scale.IntervalsCount := 4;
    
// Set colors of scale intervals
    Scale.Color(0) := GxColor.FromName("Red");
    Scale.Color(
1) := GxColor.FromName("Blue");
    Scale.Color(
2) := GxColor.FromName("Green");
    Scale.Color(
3) := GxColor.FromName("Yellow");
    
// Execute recalculation of color scale
    Scale.Recalc;
    
// Display the number of scale intervals and the index of the second interval to the console
    Debug.WriteLine("Number of used scale intervals: " + Scale.GetUsedIntervalsCount.ToString);
    Debug.WriteLine(
"Index of the second scale interval: " + Scale.GetUsedIntervalIndex(1).ToString);
End Sub Button1OnClick;

When executing the example, select a range of table cells and click the button. After that, conditional formatting will be applied to the selected cells. The number of color scale intervals and the index of the second interval will be displayed to console.

See also:

ITabFormatScale