Type | Description |
Use the RClick event to add your context menu. The RClick event notifies your application when the user right clicks the control. Use the Click event to notify your application that the user clicks the control ( using the left mouse button ). Use the MouseDown or MouseUp event if you require the cursor position during the RClick event. Use the RClickSelect property to specify whether the user can select items by right clicking the mouse. Use the ItemFromPoint property to get the item from point. Use the ColumnFromPoint property to get the column from point.
Syntax for RClick event, /NET version, on:
private void RClick(object sender) { } Private Sub RClick(ByVal sender As System.Object) Handles RClick End Sub |
private void RClick(object sender, EventArgs e) { } void OnRClick() { } void __fastcall RClick(TObject *Sender) { } procedure RClick(ASender: TObject; ); begin end; procedure RClick(sender: System.Object; e: System.EventArgs); begin end; begin event RClick() end event RClick Private Sub RClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RClick End Sub Private Sub RClick() End Sub Private Sub RClick() End Sub LPARAMETERS nop PROCEDURE OnRClick(oList) RETURN |
<SCRIPT EVENT="RClick()" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function RClick() End Function </SCRIPT> Procedure OnComRClick Forward Send OnComRClick End_Procedure METHOD OCX_RClick() CLASS MainDialog RETURN NIL void onEvent_RClick() { } function RClick as v () end function function nativeObject_RClick() return |
The following VB sample displays the cell over the cursor:
Private Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim c As Long, i As Long, hit As HitTestInfoEnum With List1 i = .ItemFromPoint(X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY, c, hit) If (i >= 0) Then If (c >= 0) Then Debug.Print .Items.Caption(i, c) End If End If End With End Sub
The following C++ sample displays the cell over the cursor:
void OnMouseUpList1(short Button, short Shift, long X, long Y) { long c = 0, hit = 0, i = m_list.GetItemFromPoint( X, Y, &c, &hit ); if ( i >= 0 ) { CItems items = m_list.GetItems(); CString strCaption = V2S( &items.GetCaption( i, COleVariant( c ) ) ); OutputDebugString( strCaption ); } }
The following VB.NET sample displays the cell over the cursor:
Private Sub AxList1_MouseUpEvent(ByVal sender As Object, ByVal e As AxEXLISTLib._IListEvents_MouseUpEvent) Handles AxList1.MouseUpEvent Dim c As Integer, hit As EXLISTLib.HitTestInfoEnum Dim i As Integer = AxList1.get_ItemFromPoint(e.x, e.y, c, hit) If (i >= 0) Then With AxList1.Items Debug.Write(.Caption(i, c)) End With End If End Sub
The following C# sample displays the cell over the cursor:
private void axList1_MouseUpEvent(object sender, AxEXLISTLib._IListEvents_MouseUpEvent e) { EXLISTLib.HitTestInfoEnum hit; int c = 0, i = axList1.get_ItemFromPoint(e.x, e.y, out c, out hit); if (i >= 0) { System.Diagnostics.Debug.WriteLine(axList1.Items.get_Caption(i, c).ToString()); } }
The following VFP sample displays the cell over the cursor:
*** ActiveX Control Event *** LPARAMETERS button, shift, x, y local c, i, hit With thisform.List1 c = 0 hit = 0 i = .ItemFromPoint(x, y, @c, @hit) If (i >= 0) wait window nowait .Items.Caption(i, c) EndIf EndWith