![]() | Type | Description | ||
| ItemIndex as Long | A long value that indicates the index of item being clicked. | |||
| ColIndex as Long | A long value that indicates the index of the column. |
The CellButtonClick event is fired after the user has released the left mouse button over a cell of button type. Use the CellHasButton property to specify whether a cell is of button type. The CellButtonClick event notifies your application that user presses a cell of button type. Use the Caption property to specify the button's caption.
The following VB sample prints the caption of the cell being clicked:
Private Sub List1_CellButtonClick(ByVal Index As Long, ByVal ColIndex As Long)
Debug.Print List1.Items.Caption(Index, ColIndex)
End SubThe following C++ sample prints the caption of the cell being clicked:
void OnCellButtonClickList1(long ItemIndex, long ColIndex)
{
CItems items = m_list.GetItems();
CString strCaption = V2S( &items.GetCaption( ItemIndex, COleVariant( ColIndex ) ) );
OutputDebugString( strCaption );
}where the V2S function converts a VARIANT expression to a string expression,
static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") )
{
if ( pv )
{
if ( pv->vt == VT_ERROR )
return szDefault;
COleVariant vt;
vt.ChangeType( VT_BSTR, pv );
return V_BSTR( &vt );
}
return szDefault;
} The following VB.NET sample prints the caption of the cell being clicked:
Private Sub AxList1_CellButtonClick(ByVal sender As Object, ByVal e As AxEXLISTLib._IListEvents_CellButtonClickEvent) Handles AxList1.CellButtonClick
With AxList1.Items
Debug.Write(.Caption(e.itemIndex, e.colIndex))
End With
End SubThe following C# sample prints the caption of the cell being clicked:
private void axList1_CellButtonClick(object sender, AxEXLISTLib._IListEvents_CellButtonClickEvent e)
{
System.Diagnostics.Debug.WriteLine(axList1.Items.get_Caption(e.itemIndex, e.colIndex).ToString());
}The following VFP sample prints the caption of the cell being clicked:
*** ActiveX Control Event *** LPARAMETERS itemindex, colindex with thisform.List1.Items wait window nowait .Caption(itemindex,colindex) endwith