hi Sergey,
I was working with list styles and invalid caret position exception appears. I have found that this exception raises when marker has one item with zero size... Please look at TRVEditRVData.OnChangeCaretLine.
There are CaretOffs variable (which was filled from constant VARGE_VALUE = 100000) and variables - First and Last. There is GetScreenLineBounds function which initializes First and Last... In this case the function returns same First as Last.
After that there is a decision wether item is rvsListMarker - result is True - so First is incremented... Following for cycle (for i := First to Last do) which should set CaretOffs not pass trough...
So in TRVEditRVData.ChangeCaret where is the decision wether exception will be risen {if (CaretOffs<0) or (CaretOffs>=CharEnds.Count) then} is clear what will follow... (CaretOffs = 100000)
i hope this will help you...
invalid caret position
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
This exception occurs in some cases when the document violates rules listed in the help file "Valid Documents" topic.
For example, when the marker is added without a subsequent item (each marker must be followed by at least one item, may be an empty text item).
Documents never become incorrect after editing operations (if they were correct initially), But using some methods for document generation, it's possible to produce incorrect documents. RVHtmlImporter sometimes creates incorrect documents.
The simplest solution - to call NormalizeRichView(RichViewEdit1.RVData) after generation (or HTML import). This function is included in NormalizeRV.pas in RichViewActions (this unit can be used separately from RichViewActions)
For example, when the marker is added without a subsequent item (each marker must be followed by at least one item, may be an empty text item).
Documents never become incorrect after editing operations (if they were correct initially), But using some methods for document generation, it's possible to produce incorrect documents. RVHtmlImporter sometimes creates incorrect documents.
The simplest solution - to call NormalizeRichView(RichViewEdit1.RVData) after generation (or HTML import). This function is included in NormalizeRV.pas in RichViewActions (this unit can be used separately from RichViewActions)
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: