how to enable edit in party area?
Posted: Tue Nov 23, 2010 3:08 pm
I uses richviewedit with table , enable user can edit in cell but user cannt edit out side table cell . how to ?
Support forums for TRichView, ScaleRichView, Report Workshop and RVMedia components
https://richedit.com/forums/
Code: Select all
var
FCurrInTable :Boolean;
procedure TfrmAppMain.rveKeyPress(Sender: TObject; var Key: Char);
var Item: TCustomRVItemInfo;
RV: TCustomRichViewEdit;
begin
rve.GetCurrentItemEx(TRVTableItemInfo, RV, Item);
FCurrInTable := Item is TRVTableItemInfo;
if not FCurrInTable then Key :=#0;
end;
procedure TfrmAppMain.rvePaste(Sender: TCustomRichViewEdit;
var Item: TCustomRVItemInfo;
RV: TCustomRichViewEdit;
begin
rve.GetCurrentItemEx(TRVTableItemInfo, RV, Item);
FCurrInTable := Item is TRVTableItemInfo;
DoDefault := FCurrInTable;
end;
Sergey Tkachenko wrote:The caret is inside table cell, if rve.InplaceEditor<>nil.
But all this code is not necessary.
If you protect the paragraph used for the table, the user will not be able to enter text outside the table.
How do you insert this table?
Code: Select all
procedure TfrmAppMain.rveKeyPress(Sender: TObject; var Key: Char);
var Item: TCustomRVItemInfo;
RV: TCustomRichViewEdit;
begin
rve.GetCurrentItemEx(TRVTableItemInfo, RV, Item);
FCurrInTable := Item is TRVTableItemInfo;
if (rve.InplaceEditor = nil) and (FCurrInTable) then
begin
Key := #0;
Exit;
end;
if not FCurrInTable then Key := #0;
end;
procedure TfrmAppMain.rvePaste(Sender: TCustomRichViewEdit;
var DoDefault: Boolean);
var Item: TCustomRVItemInfo;
RV: TCustomRichViewEdit;
begin
rve.GetCurrentItemEx(TRVTableItemInfo, RV, Item);
FCurrInTable := Item is TRVTableItemInfo;
if (rve.InplaceEditor = nil) and (FCurrInTable) then
begin
DoDefault := False;
Exit;
end;
DoDefault := FCurrInTable;
end;
Code: Select all
procedure TForm3.RichViewEdit1OleDragOver(Sender: TCustomRichView;
Shift: TShiftState; X, Y: Integer;
PossibleDropEffects: TRVOleDropEffects;
var DropEffect: TRVOleDropEffect);
var RVData: TCustomRVFormattedData;
ItemNo, Offs: Integer;
P: TPoint;
begin
P := Sender.ClientToDocument(Point(X, Y));
Sender.GetItemAt(P.X, P.Y, RVData, ItemNo, Offs, False);
if RVData=Sender.RVData then
DropEffect := rvdeNone;
end;
procedure TForm3.RichViewEdit1OleDrop(Sender: TCustomRichView;
const DataObject: IDataObject; Shift: TShiftState; X, Y: Integer;
PossibleDropEffects: TRVOleDropEffects; var DropEffect: TRVOleDropEffect;
var DoDefault: Boolean);
var RVData: TCustomRVFormattedData;
ItemNo, Offs: Integer;
P: TPoint;
begin
P := Sender.ClientToDocument(Point(X, Y));
Sender.GetItemAt(P.X, P.Y, RVData, ItemNo, Offs, False);
if RVData=Sender.RVData then begin
DropEffect := rvdeNone;
DoDefault := False;
end;
end;