- Offizieller Beitrag
ZitatDoes InsertTextAtCP not exist in WPTools5 or is there a differnet way to insert text at the cusor position?
The new concept made it possible to get rid of a lot of overhead.
It does not exist anymore. Please always use 'InputString' (in R3 a delay is possible - this has been fixed in the upcoming R4)
InputString, due to the new concept of delayed reformat and redraw should perform extremely fast.
This code executes instantly:
procedure TForm1.CreateBlockOfText(Sender: TObject);
var i,j : Integer;
begin
WPRichText1.Clear;
WPRichText1.CurrAttr.Alignment := paralBlock;
with WPRichtext1.TextObjects.InsertCopy(Image1.Picture.Graphic) do
begin
PositionMode := wpotPar;
Wrap := wpwrBoth;
RelX := 2000;
end;
for i:=1 to 200 do
begin
// WPRichText1.NewUndolevel;
WPRichText1.InputString('A');
for j:=1 to Random(20) do
WPRichText1.InputString('i');
WPRichText1.InputString('b');
WPRichText1.InputString(#32);
end;
end;
Alles anzeigen
Please also note the various Insert procedures in the TParagraph object.
ZitatAlles anzeigenfunction Insert(index: Integer; const TxtObject: TWPTextObj; const CharAttrRec: TWPCharAttr; ObjChar: WideChar =
TextObjCode): Integer; overload;
function Insert(index: Integer; const TxtObject: TWPTextObj; const CharAttr: Cardinal = 0; ObjChar: WideChar =
TextObjCode): Integer; overload;
function Insert(index: Integer; const Text: WideString; const a: TWPCharAttr): Integer; overload;
function Insert(index: Integer; const Text: WideString; const CharAttrIndex: Cardinal): Integer; overload;
function Insert(index: Integer; SourcePar: TParagraph; MaxCount: Integer = MaxInt): Integer; overload;
procedure AppendChar(const C: WideChar; const a: TWPCharAttr); overload;
procedure AppendChar(const C: WideChar; const aindex: Integer); overload;