Цитата(095 @ 3.11.2007, 16:32 ) | | А как узнать достигли ли символы MaxLength или нет? |
| Код | unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, clipbrd;
type TForm1 = class(TForm) Edit1: TEdit; Edit2: TEdit; procedure Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (ssCtrl in Shift) and (Key = ord('V')) then if (Length(clipboard.astext) > (Sender as TEdit).MaxLength) and not ((Sender as TEdit).MaxLength = 0) then ShowMessage('текст длинне максимально допустимого'); end;
end.
|
|