Specifies a menu item that copies selected text from a control to the Windows Clipboard.

Property of

MenuBar

Description

The editCopyMenu property contains a reference to a menu object users select when they want to copy text.

You can use the editCopyMenu property of a form's menuBar to copy selected text to the Windows Clipboard from any edit control in the form, instead of using the control's copy( ) method. In effect, editCopyMenu calls copy( ) for the active control. This lets you provide a way to copy text with less programming than would otherwise be needed. The Copy menu item is automatically disabled when no text is selected, and enabled when text is selected.

For example, suppose you have a Browse object (b) and an Editor object (e) on a form (f). To implement text copying, you could specify actions that would call b.copy( ) or e.copy( ) whenever a user wanted to copy text. However, if you use a menuBar, you can set the editCopyMenu property to the menu item the user will select to copy text. Then, when the user selects that menu item, the text is automatically copied to the Windows Clipboard from the currently active control. You don't need to use the control's copy( ) method at all.

If you use the Menu designer to create a menubar, editCopyMenu is automatically set to an item named Copy on a pulldown menu named Edit when you add the Edit menu to the menubar:

this.EditCopyMenu = this.Edit.Copy