trichview.support
Re: Text AFTER a hyperlink? |
Author |
Message |
Marc |
Posted: 01/31/2003 1:23:04 Hi Sergey/Mark, >It's enough just to call ApplyTextStyle(0). Document will not be changed, That's great if you want to revert back to your default style 0 and 'close off' a hyperlink. What I wanted to accomplish was to go back to the style that was in effect just before the hyperlink was applied. This is how I did it: > rve.ApplyStyleConversion(REMOVEHYPERLINK) You need to use the 'OnStyleConversion' event. The idea of the routine below is to work backwards from the current item to find the item before the hyperlink, and use the formatting style in effect just before the 'jump' hyperlink, and then only use style 0 if not other style is found. procedure TForm.rveStyleConversion(Sender: TCustomRichViewEdit; StyleNo, UserData: Integer; AppliedToText: Boolean; var NewStyleNo: Integer); var PriorStyleNo,CurrentStyleNo:integer; a:integer; begin case UserData of 1:{REMOVEHYPERLINK} begin NewStyleNo:=-1; CurrentStyleNo:=rve.getitemstyle(rve.curitemno); if rve.CurItemNo>0 then for a:=rve.CurItemNo downto 0 do begin PriorStyleNo:=rve.getitemstyle(a); if (PriorStyleNo<>CurrentStyleNo) and (not (RvStyle1.TextStyles[a].Jump)) then begin NewStyleNo:=PriorStyleNo; break; end; end; if NewStyleNo=-1 then begin NewStyleNo := 0; end; end; end; end; Hope that helps :-) Marc |
Powered by ABC Amber Outlook Express Converter