Halt STOP!
Delphi-Quellcode:
procedure TSizeEdit.CNCommand(var Message: TWMCommand);
var CurPos : Integer;
begin
if Message.NotifyCode=EN_CHANGE then //Achtung, hier musst du noch filtern!
begin
CurPos := self.SelStart;
Text := CheckText(Text);
if CurPos > Length(Text) then
self.SelStart := Length(Text)
else
self.SelStart := CurPos;
inherited;
end;
end;
Ich weis nicht genau wie die
VCL aufgebaut ist, aber du läufst Gefahr noch andere CommandMessages mitzunehmen. Vielleicht die da:
Zitat von
msdn:
EN_CHANGE The user has modified text in an edit control. Windows updates the display before sending this message (unlike EN_UPDATE).
EN_ERRSPACE The edit control cannot allocate enough memory to meet a specific request.
EN_HSCROLL The user has clicked the edit control's horizontal scroll bar. Windows sends this message before updating the screen.
EN_KILLFOCUS The user has selected another control.
EN_MAXTEXT While inserting text, the user has exceeded the specified number of characters for the edit control. Insertion has been truncated. This message is also sent either when an edit control does not have the ES_AUTOHSCROLL style and the number of characters to be inserted exceeds the width of the edit control or when an edit control does not have the ES_AUTOVSCROLL style and the total number of lines to be inserted exceeds the height of the edit control.
EN_SETFOCUS The user has selected this edit control.
EN_UPDATE The user has altered the text in the edit control and Windows is about to display the new text. Windows sends this message after formatting the text, but before displaying it, so that the application can resize the edit control window.
EN_VSCROLL The user has clicked the edit control's vertical scroll bar. Windows sends this message before updating the screen.
Dieser Beitrag ist für Jugendliche unter 18 Jahren nicht geeignet.