As I say in the title, I want to limit the number of lines writed by the user in a TRichViewEdit.
Maybe there are different ways :
- disable KeyPress if line count > 12
- unable the rve to scroll is user want to begin a 13th line
- other idea
Thanks
I want the user cannot write more than 12 lines
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: I want the user cannot write more than 12 lines
There is no built-in line count limitation.
You can process OnChange event.
In this event, check line count:
If not ok, call Undo.
You can process OnChange event.
In this event, check line count:
Code: Select all
function IsParaCountOk(rv: TCustomRichView; MaxCount: Integer): Boolean;
var
Count: Integer;
begin
Result := False;
Count := 0;
for i := 0 ro rv.ItemCount - 1 do
if rv.IsFromNewLine[i] then
begin
inc(Count);
if Count > MaxCount then
exit;
end;
Result := True;
end;