ITabFormatCellContent.DateCondition

Syntax

DateCondition: TabConditionCellContentDate

Description

The DateCondition property determines a condition by date, which should be verified for formatted cells.

Comments

The property is used if ContentType is set to the Date value.

Example

Executing the example requires a form with the Button1 button located on it, the TabSheetBox component named TabSheetBox1 and a data source for TabSheetBox.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Tab: ITabSheet;
    Range: ITabRange;
    FormCond: ITabFormatCondition;
    ValFormat: ITabFormatCellContent;
    Style: ITabCellStyle;
Begin
    Style := New TabCellStyle.Create;
    Style.Font.Color := GxColor.FromName("White");
    Style.BackgroundColor := GxColor.FromName("Black");
    Tab := TabSheetBox1.Source.GetTabSheet;
    Range := Tab.View.Selection.Range;
    FormCond := Range.FormatConditions.Add;
    FormCond.Type := TabConditionType.CellContent;
    ValFormat := FormCond.Details As ITabFormatCellContent;
    ValFormat.ContentType := TabFormatContentType.Date;
    ValFormat.DateCondition := TabConditionCellContentDate.Last7Days;
    ValFormat.Style := Style;
End Sub Button1OnClick;

As a result, when the button is clicked, a conditional format to be applied to cells with certain values will be added for the selected cell range. Cell values, containing a date from the last 7 days range, will be displayed in white font on the black background.

See also:

ITabFormatCellContent