property Edit.ContextMenuItems as String
Specifies a list of items that are added to the control's context menu.

 TypeDescription 
   String A string expression that indicates the list of items being added to the control's context menu.    

The control's context menu is displayed if the user right clicks the control. Use the ContextMenuItems property to add new entries to the control's context menu. Use the AllowContextMenu property to enable the control's context menu. The items in the context menu are separated by #13 ( carriage return, vbCr ) character. The ExecuteContextMenu event occurs if the user selects a custom entry in the control's context menu. 

The following sample adds three new entries to the control's context menu:

Private Sub Form_Load()
    With Edit1
        .AllowContextMenu = True
        .ContextMenuItems = vbCr & "Item 1" & vbCr & "Item 2" & vbCr & vbCr & "Last Item"
    End With
End Sub

The separator item is represented by an empty item.

The following C++ sample adds some custom entries to the control's context menu: 

m_edit.SetAllowContextMenu( TRUE );
CString strCustom( "\r" );
strCustom += "Item 1";
strCustom += "\r\r";
strCustom += "Item 2";
strCustom += "\r";
strCustom += "Item 3";
m_edit.SetContextMenuItems( strCustom );

The following VB.NET sample adds some custom entries to the control's context menu: 

With AxEdit1
    .AllowContextMenu = True
    .ContextMenuItems = vbCr & "Item 1" & vbCr & vbCr & "Item 2" & vbCr & "Item 3"
End With

The following C# sample adds some custom entries to the control's context menu: 

axEdit1.AllowContextMenu = true;
axEdit1.ContextMenuItems = "\rItem1\r\rItem2\rItem3";

The following VFP sample adds some custom entries to the control's context menu:

with thisform.Edit1
	.AllowContextMenu = .t.
	.ContextMenuItems = chr(13) + "Item 1" + chr(13) + chr(13) + "Item 2" + chr(13) + "Item 3"
endwith

 


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