TCustomRVFormattedData.Item2DrawItem

General TRichView support forum. Please post your questions here
Post Reply
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

TCustomRVFormattedData.Item2DrawItem

Post by Graham »

Using our new routine to get the text as displayed from a specified Y position the Item2DrawItem gets called. However this routine seems to fail if the line of text consists of single word that is too long to fit on the line.

Original code:

if (DrawItems.ItemNo<>ItemNo) or
((DrawItems.Offs>=ItemOffs) and not (DrawItems[i-1].Offs+DrawItems[i-1].Length<ItemOffs)) then begin

take out the = and replace with:

if (DrawItems.ItemNo<>ItemNo) or
((DrawItems.Offs>ItemOffs) and not (DrawItems[i-1].Offs+DrawItems[i-1].Length<ItemOffs)) then begin


This seems to fix my problem, but does this have any other undesired effects?
I have sent you some screen shots to show you the problem.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

The method is correct, however the function returning the line text is wrong.
We cannot use (ItemNo, OffsetInItem) values to identify a line, because it is possible that this position corresponds to two places on the screen (the end of the line N, and the beginning of the line N+1).
So we must work with drawing items directly. Details are sent by email.
Post Reply