- Checking for Index < Count right at the start of the method.
- Using Add in place of Put on line 1341 in the event that Index = Count
RVRVData.PAS - TRVFontInfoCacheFast.GetItems Bug
RVRVData.PAS - TRVFontInfoCacheFast.GetItems Bug
I find that if I attempt to edit the last line of text in a TRichViewEdit control an exception is thrown. This appears to happen because the Index passed to the TRVFontInfoCacheFast.GetItems method is equal to TRVFontInfoCacheFast.Count. I have fixed this for now by doing two things
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
The reason of this exception is quite obvious: your document contains a text item having incorrect StyleNo (valid values are from 0 to RVStyle.TextStyles.Count-1). Please check how your document is generated and fix this bug.
From the other hand, this situation must be handled by TRichView gracefully, without throwing an exception. This text must be formatted using RVStyle.TextStyles.InvalidItem. This is how it was in older version, but now this feature is lost. It will be fixed in the next update.
From the other hand, this situation must be handled by TRichView gracefully, without throwing an exception. This text must be formatted using RVStyle.TextStyles.InvalidItem. This is how it was in older version, but now this feature is lost. It will be fixed in the next update.
Thank you! I'll look into what is happening on the styles front.Sergey Tkachenko wrote:The reason of this exception is quite obvious: your document contains a text item having incorrect StyleNo (valid values are from 0 to RVStyle.TextStyles.Count-1). Please check how your document is generated and fix this bug.
From the other hand, this situation must be handled by TRichView gracefully, without throwing an exception. This text must be formatted using RVStyle.TextStyles.InvalidItem. This is how it was in older version, but now this feature is lost. It will be fixed in the next update.
I looked at my code here as well as the various RVFOptions settings. Here is what I am doing
a. I use the same RichViewEdit component to load text from several text streams - only one is viewable and editable at any given time.
b. Whenever I load a new text stream I am clearing the RVE first.
c. Under RVFOptions I have the rvfoSaveTextStyles and rvfoSaveParaStyles flags set.
d. The two ...StyleReadMode properties are both set to rvf_sInsertMerge.
To save edited text I use SaveRVFToStream and to reload it I use LoadRVFFromStream. I call the Format method after loading.
I could be missing something but strikes me that I am doing everything right. Any thoughts?
a. I use the same RichViewEdit component to load text from several text streams - only one is viewable and editable at any given time.
b. Whenever I load a new text stream I am clearing the RVE first.
c. Under RVFOptions I have the rvfoSaveTextStyles and rvfoSaveParaStyles flags set.
d. The two ...StyleReadMode properties are both set to rvf_sInsertMerge.
To save edited text I use SaveRVFToStream and to reload it I use LoadRVFFromStream. I call the Format method after loading.
I could be missing something but strikes me that I am doing everything right. Any thoughts?
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: