JVCL Help:FixedDefaultEditPopup

From Project JEDI Wiki
Jump to navigationJump to search
JEDI Visual Component Library Help

Search in JVCL Help

 
Search in all projects
 

Summary

Returns a popup menu that implements the basic actions normally associated with an edit control.

run\JvFixedEditPopUp.pas


Pascal

 run\JvFixedEditPopUp.pas
 functionFixedDefaultEditPopup(AEdit: TWinControl; Update: Boolean = True): TPopupMenu;


Parameters

Parameters Description
AEdit: TWinControl The control to associate the popup menu with.
Update: Boolean = True Specifies whether to update the enabled state of the menu items.

run\JvFixedEditPopUp.pas


Description

Use FixedDefaultEditPopup to access a default implementation of an edit control's popup menu. This function accomplishes two things: it enables a custom control to easily support a default edit popup menu with Cut, Copy, Paste etc. commands and it fixes a bug in the default popup implementation in TCustomEdit and TCustomMemo.
The edit control as implemented by Microsoft has one minor bug: the paste command is enabled even when the control is marked as read-only. No actual paste is possible, however. The popup menu returned by the function fixes this bug.
To enable a custom control to react to the commands of the popup menu, it must handle several messages and set certain windows styles. The messages the control must handle are:

Message Action
WM_CUT Cuts the selected text
WM_COPY Copies the selected text
WM_PASTE Paste text into the current selection
WM_CLEAR Deletes current selection
EM_SETSEL Select all text (if wParam = 0 and lParam = -1)
EM_GETSEL Return the current selection
WM_UNDO Undo last edit command
EM_CANUNDO Return whether undo is available


In addition, the control should set the ES_READONLY style for the control if it has a read-only property or if it is read-only by default. Setting the ES_READONLY style, can be done with SetWindowLong using GWL_STYLE.

run\JvFixedEditPopUp.pas


See Also

FixedDefaultEditPopUseResourceString

run\JvFixedEditPopUp.pas


About

Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page