property Column.FireFormatColumn as Boolean

Retrieves or sets a value that indicates whether the control fires FormatColumn to format the caption of a cell hosted by column.

 TypeDescription 
   Boolean A boolean expression that indicates whether the control fires the FireFormatColumn event for the cells in the column.  

By default, the FireFormatColumn property  is False. The FormatColumn event is fired only if the FireFormatColumn property of the Column object is True. The FormatColumn event lets the user to provide the cell's caption before it is displayed on the control's list. For instance, the FormatColumn event is useful when the column cells contains prices ( numbers ), and you want to display that column formatted as currency, like $50 instead 50. Also, it is useful to use the FormatColumn event when displaying computed cells. Newer versions of the component provides the FormatColumn property that helps formatting a cell using the several predefined functions without using the control's event FormatColumn.

The CellValue property of the cell is being shown as:

In other words, all cells applies the format of the FormatColumn property, excepts the cells with the FormatCell property being set. If the cell belongs to a column with the FireFormatColumn property on True, the Value parameter of the FormatColumn event shows the newly caption for the cell to be shown.

The FormatColumn event is fired before displaying a cell, so you can handle the FormatColumn to display anything on the cell at runtime. This way you can display the row position, you can display the value using the currency format, and so on. The FireFormatColumn property allows the control to fire the FormatColumn event for the column. The Position property specifies the position of the column.

The following VB sample handles the FormatColumn event to display the row position:

Private Sub G2antt1_FormatColumn(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long, Value As Variant)
    Value = G2antt1.Items.ItemPosition(Item)
End Sub 
Private Sub G2antt1_FormatColumn(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long, Value As Variant)
    Value = G2antt1.ScrollPos(True) + RelPos(Item)
End Sub

Private Function RelPos(ByVal hVisible As Long) As Long
    With G2antt1.Items
        Dim h As Long, i As Long, n As Long
        i = 0
        n = .VisibleCount + 1
        h = .FirstVisibleItem
        While (i <= n) And h <> 0 And h <> hVisible
            i = i + 1
            h = .NextVisibleItem(h)
        Wend
        RelPos = i
    End With
End Function

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.