I have a routine that I have been using to format different strings as I added then to a TRichViewEdit. Up until I upgraded my Richview stuff it worked perfect and as a matter of fact, it still does, but only when run outside of the IDE. Here is the code and the error is noted:
Code: Select all
procedure TMain.ChangeFonts(TheFont,TheSize,TheColor,TheBColor,B,I,U,P:string);
begin
with RVS.TextStyles.Add do
begin
FontName := TheFont;
Size := strtoint(TheSize);
Color:= stringtocolor(TheColor);
BackColor:=stringtocolor(TheBColor);
if B='1' then
Style := Style+[fsbold] else
Style := Style-[fsbold];
if I='1' then
Style := Style+[fsitalic] else
Style := Style-[fsitalic];
if U='1' then
Style := Style+[fsunderline] else
Style := Style-[fsunderline];
RVE.ApplyTextStyle(RVS.TextStyles.Count-1); <-----Exception here EList Error "List Index out of bounds (-1)
ts:=RVS.TextStyles.Count-1;
with RVS.ParaStyles.Add do
begin
if P='0' then Alignment:=rvaLeft;
if P='1' then Alignment:=rvaCenter;
if P='2' then Alignment:=rvaRight;
RVE.ApplyParaStyle(RVS.ParaStyles.Count-1);
ps:=RVS.ParaStyles.Count-1;
end;
end;
end;
Thanks,
Bruce