ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1TrueDBGrid.FetchCellTips Event

Occurs when the grid needs to display CellTips.

[Visual Basic]

Public Event FetchCellTips As FetchCellTipsEventHandler

[C#]

public event FetchCellTipsEventHandler FetchCellTips

[Delphi]

public property FetchCellTips: FetchCellTipsEventHandler read remove_FetchCellTips write add_FetchCellTips;

Remarks

If the cursor is over a data cell, FetchCellTipsEventArgs.CellTip contains the contents of the cell as text. By default, the grid will display up to 256 characters of the cell contents in a pop-up text box, enabling the user to peruse the contents of a cell even if it is not big enough to be displayed in its entirety. Instead of displaying the cell text, modify the FetchCellTipsEventArgs.CellTip to display a custom message. However, if FetchCellTipsEventArgs.CellTip is set to Null or an empty string, the text box will not be displayed.

Program this event to provide context-sensitive help or tips to users. For example, if the user points to column header, provide a more detailed description of the column. If the user points to a record selector, display instructions for selecting multiple records.

Also provide content-sensitive help to users using this event. By default, FetchCellTipsEventArgs.CellTip contains the text of the cell under the cursor. However, other cell values can be determined if desired. Using the grid's Row property, retrieve the bookmark of the row under the cursor, then use the C1DataColumn.CellValue or C1DataColumn.CellText method to derive other cell values.

Example

The following code displays the contents of the invisible column Description for each row:

·      Visual Basic

       Private Sub C1TrueDBGrid1_FetchCellTips(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.FetchCellTipsEventArgs) Handles C1TrueDBGrid1.FetchCellTips

           Dim row As Integer = e.Row

           If Me.C1TrueDBGrid1.FocusedSplit.Rows(e.Row).RowType = C1.Win.C1TrueDBGrid.RowTypeEnum.DataRow Then

               row = Me.C1TrueDBGrid1.RowBookmark(e.Row)

           End If

           e.CellTip = Me.C1TrueDBGrid1.Columns("Description").CellText(e.Row)

       End Sub

·      C#

       private void C1TrueDBGrid1_FetchCellTips(object sender, C1.Win.C1TrueDBGrid.FetchCellTipsEventArgs e)

       {

           int row = e.Row;

           if(this.c1TrueDBGrid1.FocusedSplit.Rows[e.Row].RowType == C1.Win.C1TrueDBGrid.RowTypeEnum.DataRow)

           {

               row = this.c1TrueDBGrid1.RowBookmark(e.Row);

           }

           e.CellTip = this.c1TrueDBGrid1.Columns["Description"].CellText(row);

       }

·      Delphi

       procedure C1TrueDBGrid1_FetchCellTips(sender: System.Object; e: C1.Win.C1TrueDBGrid.FetchCellTipsEventArgs);

       var

         row : Integer;

       begin 

         row := e.Row;

         if (Self.C1TrueDBGrid1.FocusedSplit.Rows[e.Row].RowType = C1.Win.C1TrueDBGrid.RowTypeEnum.DataRow) then

           row := Self.C1TrueDBGrid1.RowBookmark(e.Row);

         e.CellTip := Self.C1TrueDBGrid1.Columns['Description'].CellText(e.Row);

       end;

See Also

C1TrueDBGrid Class | C1TrueDBGrid Members | C1.Win.C1TrueDBGrid Namespace


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.