I use the following code to read three lines of text:
Code
var
par : TParagraph;
procedure ReadThreeLines;
var
s : string;
pos : integer;
LocalLine : integer;
LocalOriginalLine : integer;
begin
LocalLine := WPRichText_Work.TextCursor.active_line;
LocalOriginalLine := LocalLine;
par := WPRichText_Work.ActiveParagraph;
if ( par <> nil ) then
s := par.GetLineText(LocalLine)
else
s := '';
LocalLineaConReferencia := s;
LocalLine := LocalOriginalLine;
if ( par <> nil ) and
( par.PrevLine(LocalLine) ) then
s := par.GetLineText(LocalLine)
else
s := '';
LocalLineaAnterior := s;
LocalLine := LocalOriginalLine;
if ( par <> nil ) and
( par.NextLine(LocalLine) ) then
s := par.GetLineText(LocalLine)
else
s := '';
LocalLineaSiguiente := s;
end;
threeLines := LocalLineaAnterior +
LocalLineaConReferencia +
LocalLineaSiguiente;
This code works perfectly if I run the program, read some text, point with the mouse to any text and press an appropiate button.
But when I run the program and want to automatize a process using CPMoveNext, threeLines appears always empty ('').
What is the problem?
With WPTools4 I use the following code to get the text in a line:
var
par : PTParagraph;
lin : PTLine;
pa : PTAttr;
pc : PChar;
lin := WPRichText.Memo.active_line;
pa := lin^.pa;
pos := 0;
s := '';
for pos := 0 to lin^.plen - 1 do begin
if not ( afsHidden in pa^.Style ) then
s := s + WPGetChar(lin, pos)^;
inc(pa);
end; // for ...
Alles anzeigen
What is the equivalent code using WPTools6?
Thank you in advance for your help.
Kind regards,
Carlos Borrero