I have some cells in table. user can insert, modify the cell text, but don't allow insert other item type into it.
how to do?
how to forbid all itemtype insert into the cell except text?
-
- Posts: 38
- Joined: Sat Nov 06, 2010 5:12 am
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Non-text items can be either pasted from Clipboard or inserted by a drag&drop.
To prevent inserting non-text items by drag&drop, you can assign rve.AcceptDragDropFormat := [rvddText, rvddUnicodeText]. Or you can forbid accepting drag&drop by assigning rve.AcceptDragDropFormat := [].
As for pasting, you can use OnPaste event. This code allows pasting only a plain text:
To prevent inserting non-text items by drag&drop, you can assign rve.AcceptDragDropFormat := [rvddText, rvddUnicodeText]. Or you can forbid accepting drag&drop by assigning rve.AcceptDragDropFormat := [].
As for pasting, you can use OnPaste event. This code allows pasting only a plain text:
Code: Select all
procedure TForm1.rvePaste(Sender: TCustomRichViewEdit;
var DoDefault: Boolean);
var s: String;
begin
if Clipboard.HasFormat(CF_TEXT) then begin
s := Clipboard.AsText;
rve.InsertText(s, False);
end;
DoDefault := False;
end;
-
- Posts: 38
- Joined: Sat Nov 06, 2010 5:12 am