Function TWPCustomRtfEdit.GetSelStartEnd(startpar:TParagraph; startpos:Integer; endpar:TParagraph; endpos:Integer) : Boolean
Unit: WPCTRMemo
Class: WPCTRMemo.TWPCustomRtfEdit
Parameters
-
startpar:TParagraph startpos:Integer endpar:TParagraph endpos:Integer
Returns
The type of the result value is Boolean.
Description
Retrieves the start and end paragraphs and position of the current text selection. Internally calls: TextCursor.GetBlockStart / GetBlockEnd;This code checks if there is a field object somewhere inside the selectin:
var spar, epar : TParagraph;
spos, epos, e : Integer;
begin
if WPRichText1.GetSelStartEnd(spar,spos,epar,epos) then
while spar<>nil do
begin
if spar=epar then e := epos else e := spar.CharCount;
while sposnil)
and (spar.ObjectRef[spos].ObjType=wpobjMergeField) then
begin
ShowMessage('We found a field');
exit;
end;
inc(spos);
end;
end;
if spar=epar then break else spar := spar.Next;
spos := 0;
end;
end;