The Delphi Bug List

Entry No.
644
VCL - Win32 - ComCtrls - TRichEdit
If pasting text into TRichEdit, and the pasted text would give a total text amount larger than the "MaxLength" of TRichEdit, the text fitting within MaxLength is pasted, but no "OnChange" event is fired.
1.02 2.01 3.0 3.01 3.02 4.0 4.01 4.02 4.03 5.0 5.01 6.0 6.01 6.02 Kylix 1.0
N/AExistsExistsExistsExistsExistsExistsExistsExistsExistsExistsExistsUnknownUnknownN/A
Description
Reported by Björn Lindell; checked by Jordan Russell
If pasting text into TRichEdit, and the pasted text would give a total text amount larger than the "MaxLength" of TRichEdit, the text fitting within MaxLength is pasted, but no "OnChange" event is fired.

If MaxLength is, say 255 chars, and the TRichEdit has a text of 240 chars, and one pastes a 100 char text into the TRichEdit, only the first 15 chars are added (which is correct), but no OnChange event is fired. If one pastes a text of exactly 15 chars or less, the OnChange is fired.

I had "PlainText" set to True and MaxLength set to a custom value, but otherwise I had not changed any properties. Debugging into the VCL, I found that "TCustomEdit.CNCommand" in "stdctrls.pas" is called in both the erroneous case (more text than can fit) and the working case (all pasted text fits). In the erroneous case the "Message.NotifyCode" has the value 1281 (meaning EN_MAXTEXT) and in the working case it has the code 768 (meaning EN_CHANGE). The procedure is written to only call "Change" if the notify code is EN_CHANGE.

This project reproduces the problem.

Note from checker:
I could reproduce this on Windows 98, Me, and NT 4.0 SP6. But on Windows 2000, OnChange was fired. So it appears that this is OS- or riched32.dll-version dependent.

Latest update of this entry: 2001-07-04

Post a comment on this bug


Index page
Delphi Bug List home page
The Delphi Bug Lists are presently maintained by Jordan Russell, who has taken over this task from Reinier Sterkenburg since August 2000.
All feedback is appreciated. See also the feedback section of the Delphi Bug List home page.