ComponentOne List for WinForms
In This Topic
    Context-Sensitive Help with CellTips
    In This Topic

    In many Windows applications, when the user points to a toolbar button and leaves the mouse at rest for a short time, a ToolTip window appears with the name of the associated command. You can provide similar context-sensitive help for your users with the CellTips property of List for WinForms.

    The CellTips property determines whether the list displays a pop-up text window when the cursor is idle. By default, this property is set to NoCellTips, and cell tips are not displayed.

    The setting Anchored aligns the cell tip window with either the left or right edge of the cell. The left edge is favored, but the right edge will be used if necessary in order to display as much text as possible.

    The setting Floating displays the cell tip window below the cursor, if possible.

    If you do not provide a handler for the FetchCellTips event, and the cursor is over a list cell, the default behavior is to display a text box containing the cell's contents (up to 256 characters). This enables the user to peruse the contents of a cell even if it is not big enough to be displayed in its entirety. You can also program the FetchCellTips event to override the default cell text display in order to provide users with context-sensitive help.

    A common application of the FetchCellTips event is to display the contents of an invisible column that provides additional information about the row being pointed to, as in the following example:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    ' General Declarations.  
    Dim DescCol As C1.Win.C1List.C1DataColumn
    
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load    
        ' Set the column to be displayed as a CellTip.   
        Set DescCol = Me.C1List1.Columns("Country")   
    End Sub
     
    Private Sub C1List1_FetchCellTips(ByVal sender As System.Object, ByVal e As C1.Win.C1List.FetchCellTipsEventArgs) Handles C1List1.FetchCellTips   
        ' Display the column.
        e.CellTip = DescCol.CellText(e.Row)
    End Sub
    

    To write code in C#

    C#
    Copy Code
    // General Declarations.
    C1.Win.C1List.C1DataColumn DescCol;
    
    private void Form1_Load( System.object sender,  System.EventArgs e)    
    { 
        // Set the column to be displayed as a CellTip.
        DescCol = this.c1List1.Columns["Country"];     
    }
    
    private void c1List1_FetchCellTips( System.object sender, C1.Win.C1List.FetchCellTipsEventArgs e)      
    {   
        // Display the column. 
        e.CellTip = DescCol.CellText(e.Row);  
    }
    

    You can use the CellTipsDelay property to control the amount of time that must elapse before the cell tip window is displayed.

    You can use the CellTipsWidth property to control the width of the cell tip window.